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

@@ -35,7 +35,6 @@ import com.google.gwtorm.server.OrmException;
import com.google.inject.Provider;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
@@ -112,12 +111,7 @@ class ConflictsPredicate extends OrPredicate<ChangeData> {
Repository repo =
args.repoManager.openRepository(otherChange.getProject());
try {
RevWalk rw = new RevWalk(repo) {
@Override
protected RevCommit createCommit(AnyObjectId id) {
return new CodeReviewCommit(id);
}
};
RevWalk rw = CodeReviewCommit.newRevWalk(repo);
try {
RevFlag canMergeFlag = rw.newFlag("CAN_MERGE");
CodeReviewCommit commit =