aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2011-07-01 11:58:24 -0400
committerCode Review <codereview-daemon@eclipse.org>2011-07-01 11:58:24 -0400
commitac56c024c119c9782beb83f022deb3b258b754dc (patch)
tree0526963a9382f0a7f629472465b7746cfea498a4
parent622d922ddc21930debb9f1c23d393cf86d4e1900 (diff)
parent872c1fec17876132e6f2b4dd4eab494aa798b933 (diff)
downloadjgit-ac56c024c119c9782beb83f022deb3b258b754dc.tar.gz
jgit-ac56c024c119c9782beb83f022deb3b258b754dc.zip
Merge "Enable PlotWalk to show additional refs"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
index ea2437ff77..de181b1037 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
@@ -51,7 +51,9 @@ import static org.eclipse.jgit.lib.Constants.R_TAGS;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Comparator;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -91,6 +93,27 @@ public class PlotWalk extends RevWalk {
reverseRefMap = repo.getAllRefsByPeeledObjectId();
}
+ /**
+ * Add additional refs to the walk
+ *
+ * @param refs
+ * additional refs
+ *
+ * @throws IOException
+ */
+ public void addAdditionalRefs(Iterable<Ref> refs) throws IOException {
+ for (Ref ref : refs) {
+ Set<Ref> set = reverseRefMap.get(ref.getObjectId());
+ if (set == null)
+ set = Collections.singleton(ref);
+ else {
+ set = new HashSet<Ref>(set);
+ set.add(ref);
+ }
+ reverseRefMap.put(ref.getObjectId(), set);
+ }
+ }
+
@Override
public void sort(final RevSort s, final boolean use) {
if (s == RevSort.TOPO && !use)