CodeReviewCommit: Add a static method to create a RevWalk

Several places in the code construct a new RevWalk subclass that
produces CodeReviewCommits. Consolidate these into a single method.

Change-Id: If38a648fb95d86f8f8297d1ddacfb9e62a96c8e3
This commit is contained in:
Dave Borowitz
2014-10-02 15:26:48 -07:00
committed by David Pursehouse
parent 8dc720ed9b
commit 839650ed0b
3 changed files with 12 additions and 14 deletions

View File

@@ -73,7 +73,6 @@ import com.google.inject.assistedinject.Assisted;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter;
@@ -389,12 +388,7 @@ public class MergeOp {
throw new MergeException(m, err);
}
rw = new RevWalk(repo) {
@Override
protected RevCommit createCommit(final AnyObjectId id) {
return new CodeReviewCommit(id);
}
};
rw = CodeReviewCommit.newRevWalk(repo);
rw.sort(RevSort.TOPO);
rw.sort(RevSort.COMMIT_TIME_DESC, true);
canMergeFlag = rw.newFlag("CAN_MERGE");