diff options
author | Stefan Lay <stefan.lay@sap.com> | 2011-07-01 17:38:01 +0200 |
---|---|---|
committer | Stefan Lay <stefan.lay@sap.com> | 2011-07-01 17:38:01 +0200 |
commit | 872c1fec17876132e6f2b4dd4eab494aa798b933 (patch) | |
tree | 737b64d72973e873911366d08afe56f19fe73c76 /org.eclipse.jgit | |
parent | eb46d7ffdc6dee1f8570d4be3b6c33cee8fa91c7 (diff) | |
download | jgit-872c1fec17876132e6f2b4dd4eab494aa798b933.tar.gz jgit-872c1fec17876132e6f2b4dd4eab494aa798b933.zip |
Enable PlotWalk to show additional refs
Change-Id: Ic85f8859571dc2aef7f146ce56a6c9b8ec142e60
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java | 23 |
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) |