diff options
Diffstat (limited to 'platform/vcs-log/api')
-rw-r--r-- | platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java | 12 | ||||
-rw-r--r-- | platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java | 17 |
2 files changed, 22 insertions, 7 deletions
diff --git a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java index 735ad0060b88..39b001f279b8 100644 --- a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java +++ b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogRefManager.java @@ -3,6 +3,7 @@ package com.intellij.vcs.log; import org.jetbrains.annotations.NotNull; import java.util.Collection; +import java.util.Comparator; import java.util.List; /** @@ -16,11 +17,16 @@ import java.util.List; public interface VcsLogRefManager { /** - * Sorts the given references. - * TODO better provide compareTo + * Return the comparator which compares two given references in terms of their "importance", + * which is later is used in the log to order branches and branch labels. + * <p><ul> + * <li>Negative value is returned if first reference is <b>more</b> important than the second (i.e. it will be at the left in the log). + * <li>Positive value is returned if first reference is <b>less</b> important than the second (i.e. it will be at the right in the log). + * <li>Zero is returned if referenced are considered equally important. + * </ul> */ @NotNull - List<VcsRef> sort(Collection<VcsRef> refs); + Comparator<VcsRef> getComparator(); /** * <p>Groups VCS references to show them on the branches panel.</p> diff --git a/platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java b/platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java index e4e9b87ad4e3..496329ec5190 100644 --- a/platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java +++ b/platform/vcs-log/api/src/com/intellij/vcs/log/graph/GraphColorManager.java @@ -36,11 +36,20 @@ public interface GraphColorManager<CommitId> { int getColorOfFragment(CommitId headCommit, int magicIndex); /** - * Returns 1, 0 or -1 if branch identified by commit {@code head1} is "more powerful", "equally powerful" or "less powerful" - * than the branch identified by commit {@code head2}. - * <p/> - * If branch1 is more powerful than branch2, it means that its color will be reused by the subgraph below the point when these branches + * Compares two head commits in terms of "importance" of reference labels pointing to these commits. + * It is used to order branches, branch labels, and for branch coloring. <br/> + * E.g. if branch1 is more important than branch2, its color will be reused by the subgraph below the point when these branches * were diverged. + * <p/> + * Then head1 is more important than head2, if its most important reference is more important than head2's most important reference + * (if they are the same, next are compared). + * <p/> + * References are compared by the following logic (see {@link com.intellij.vcs.log.VcsLogRefManager}: <ul> + * <li>Negative value is returned if first reference is <b>more</b> important than the second (i.e. it will be at the left in the log). + * <li>Positive value is returned if first reference is <b>less</b> important than the second (i.e. it will be at the right in the log). + * <li>Zero is returned if referenced are considered equally important. + * </ul> + * <p> */ int compareHeads(CommitId head1, CommitId head2); // todo drop this |