Merge "ReceiveCommits: Refactor to prevent resource warning in Eclipse 4.5"

This commit is contained in:
Edwin Kempin 2015-07-14 15:09:30 +00:00 committed by Gerrit Code Review
commit 39bffdcae7

View File

@ -1489,27 +1489,28 @@ public class ReceiveCommits {
private void selectNewAndReplacedChangesFromMagicBranch() { private void selectNewAndReplacedChangesFromMagicBranch() {
newChanges = Lists.newArrayList(); newChanges = Lists.newArrayList();
final RevWalk walk = rp.getRevWalk();
SetMultimap<ObjectId, Ref> existing = changeRefsById(); SetMultimap<ObjectId, Ref> existing = changeRefsById();
GroupCollector groupCollector = new GroupCollector(refsById, db); GroupCollector groupCollector = new GroupCollector(refsById, db);
walk.reset(); rp.getRevWalk().reset();
walk.sort(RevSort.TOPO); rp.getRevWalk().sort(RevSort.TOPO);
walk.sort(RevSort.REVERSE, true); rp.getRevWalk().sort(RevSort.REVERSE, true);
try { try {
walk.markStart(walk.parseCommit(magicBranch.cmd.getNewId())); rp.getRevWalk().markStart(
rp.getRevWalk().parseCommit(magicBranch.cmd.getNewId()));
if (magicBranch.baseCommit != null) { if (magicBranch.baseCommit != null) {
for (RevCommit c : magicBranch.baseCommit) { for (RevCommit c : magicBranch.baseCommit) {
walk.markUninteresting(c); rp.getRevWalk().markUninteresting(c);
} }
Ref targetRef = allRefs.get(magicBranch.ctl.getRefName()); Ref targetRef = allRefs.get(magicBranch.ctl.getRefName());
if (targetRef != null) { if (targetRef != null) {
walk.markUninteresting(walk.parseCommit(targetRef.getObjectId())); rp.getRevWalk().markUninteresting(
rp.getRevWalk().parseCommit(targetRef.getObjectId()));
} }
} else { } else {
markHeadsAsUninteresting( markHeadsAsUninteresting(
walk, rp.getRevWalk(),
magicBranch.ctl != null ? magicBranch.ctl.getRefName() : null); magicBranch.ctl != null ? magicBranch.ctl.getRefName() : null);
} }
@ -1518,7 +1519,7 @@ public class ReceiveCommits {
final int maxBatchChanges = final int maxBatchChanges =
receiveConfig.getEffectiveMaxBatchChangesLimit(currentUser); receiveConfig.getEffectiveMaxBatchChangesLimit(currentUser);
for (;;) { for (;;) {
final RevCommit c = walk.next(); final RevCommit c = rp.getRevWalk().next();
if (c == null) { if (c == null) {
break; break;
} }