diff options
author | Shawn Pearce <spearce@spearce.org> | 2014-04-19 20:02:19 -0700 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2014-04-21 11:43:02 -0700 |
commit | 2ee4d4a2c732171cd33d373df49093ff8ff4b775 (patch) | |
tree | ee170a0b93e75b9645abe52d29f7ef6796b1b4fc /org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java | |
parent | 6afae79901f7d3fe7598c81f7474bc98c29909b9 (diff) | |
download | jgit-2ee4d4a2c732171cd33d373df49093ff8ff4b775.tar.gz jgit-2ee4d4a2c732171cd33d373df49093ff8ff4b775.zip |
blame: Allow candidate to manage its setup before output
Pass in the RevWalk and let the candidate decide how to prepare itself
for output. This removes the conditional for the missing sourceCommit,
as candidates missing a commit can override the method with a no-op.
Change-Id: I3fa19b8676dfd3c177583f8f42593b5000b5350d
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java index a652278d05..c7c34f0a3a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/Candidate.java @@ -49,6 +49,7 @@ import org.eclipse.jgit.blame.ReverseWalk.ReverseCommit; import org.eclipse.jgit.diff.Edit; import org.eclipse.jgit.diff.EditList; import org.eclipse.jgit.diff.RawText; +import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; @@ -56,6 +57,7 @@ import org.eclipse.jgit.lib.ObjectReader; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevFlag; +import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.treewalk.filter.PathFilter; /** @@ -114,6 +116,10 @@ class Candidate { recursivePath = path.shouldBeRecursive(); } + void beginResult(RevWalk rw) throws MissingObjectException, IOException { + rw.parseBody(sourceCommit); + } + int getParentCount() { return sourceCommit.getParentCount(); } @@ -406,6 +412,11 @@ class Candidate { } @Override + void beginResult(RevWalk rw) { + // Blob candidates have nothing to prepare. + } + + @Override int getParentCount() { return parent != null ? 1 : 0; } |