mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 09:03:31 +07:00
[hg] mercurial reference comparator works better for references in different roots
Comparator can be given references from two different vcs rooots, which means two separate "default" branches. This could lead to ambiguous results, since the old code did not expect that. So, check if name is the same first, only then check if one reference is a default branch. (Possible fix for EA-75749)
This commit is contained in:
@@ -42,7 +42,7 @@ public class HgRefManager implements VcsLogRefManager {
|
||||
public static final VcsRefType TAG = new SimpleRefType(false, VcsLogStandardColors.Refs.TAG);
|
||||
public static final VcsRefType LOCAL_TAG = new SimpleRefType(false, LOCAL_TAG_COLOR);
|
||||
public static final VcsRefType MQ_APPLIED_TAG = new SimpleRefType(false, MQ_TAG_COLOR);
|
||||
|
||||
|
||||
// first has the highest priority
|
||||
private static final List<VcsRefType> REF_TYPE_PRIORITIES = Arrays.asList(TIP, HEAD, BRANCH, BOOKMARK, TAG);
|
||||
|
||||
@@ -71,18 +71,19 @@ public class HgRefManager implements VcsLogRefManager {
|
||||
return typeComparison;
|
||||
}
|
||||
|
||||
if (type1 == BRANCH) {
|
||||
if (ref1.getName().equals(DEFAULT)) {
|
||||
return -1;
|
||||
}
|
||||
if (ref2.getName().equals(DEFAULT)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
int nameComparison = ref1.getName().compareTo(ref2.getName());
|
||||
if (nameComparison != 0) {
|
||||
if (type1 == BRANCH) {
|
||||
if (ref1.getName().equals(DEFAULT)) {
|
||||
return -1;
|
||||
}
|
||||
if (ref2.getName().equals(DEFAULT)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return nameComparison;
|
||||
}
|
||||
|
||||
return VcsLogUtil.compareRoots(ref1.getRoot(), ref2.getRoot());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user