|
|
@ -45,12 +45,15 @@ |
|
|
|
package org.eclipse.jgit.revplot; |
|
|
|
package org.eclipse.jgit.revplot; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.JGitText; |
|
|
|
import org.eclipse.jgit.JGitText; |
|
|
|
|
|
|
|
import org.eclipse.jgit.errors.IncorrectObjectTypeException; |
|
|
|
|
|
|
|
import org.eclipse.jgit.errors.MissingObjectException; |
|
|
|
import org.eclipse.jgit.lib.AnyObjectId; |
|
|
|
import org.eclipse.jgit.lib.AnyObjectId; |
|
|
|
import org.eclipse.jgit.lib.PersonIdent; |
|
|
|
import org.eclipse.jgit.lib.PersonIdent; |
|
|
|
import org.eclipse.jgit.lib.Ref; |
|
|
|
import org.eclipse.jgit.lib.Ref; |
|
|
@ -93,23 +96,26 @@ public class PlotWalk extends RevWalk { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected RevCommit createCommit(final AnyObjectId id) { |
|
|
|
protected RevCommit createCommit(final AnyObjectId id) { |
|
|
|
return new PlotCommit(id, getTags(id)); |
|
|
|
return new PlotCommit(id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@Override |
|
|
|
* @param commitId |
|
|
|
public RevCommit next() throws MissingObjectException, |
|
|
|
* @return return the list of knows tags referring to this commit |
|
|
|
IncorrectObjectTypeException, IOException { |
|
|
|
*/ |
|
|
|
PlotCommit<?> pc = (PlotCommit) super.next(); |
|
|
|
protected Ref[] getTags(final AnyObjectId commitId) { |
|
|
|
if (pc != null) |
|
|
|
|
|
|
|
pc.refs = getTags(pc); |
|
|
|
|
|
|
|
return pc; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Ref[] getTags(final AnyObjectId commitId) { |
|
|
|
Collection<Ref> list = reverseRefMap.get(commitId); |
|
|
|
Collection<Ref> list = reverseRefMap.get(commitId); |
|
|
|
Ref[] tags; |
|
|
|
Ref[] tags; |
|
|
|
if (list == null) |
|
|
|
if (list == null) |
|
|
|
tags = null; |
|
|
|
tags = null; |
|
|
|
else { |
|
|
|
else { |
|
|
|
tags = list.toArray(new Ref[list.size()]); |
|
|
|
tags = list.toArray(new Ref[list.size()]); |
|
|
|
// TODO hotfix, this results in a loop and consequently stack overflow
|
|
|
|
Arrays.sort(tags, new PlotRefComparator()); |
|
|
|
// when opening the history view in EGit
|
|
|
|
|
|
|
|
// Arrays.sort(tags, new PlotRefComparator());
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return tags; |
|
|
|
return tags; |
|
|
|
} |
|
|
|
} |
|
|
|