int (Integer head1, Integer head2) { if (head1.equals(head2)) { return 0; } VcsRef ref1 = myRefsModel.bestRefToHead(head1); VcsRef ref2 = myRefsModel.bestRefToHead(head2); if (ref1 == null) { reportNoRefs(head1); if (ref2 == null) { reportNoRefs(head2); return head1 - head2; } return 1; } if (ref2 == null) { reportNoRefs(head2); return -1; } if (ref1.equals(ref2)) { LOG.warn("Different heads " + myHashGetter.fun(head1) + " and " + myHashGetter.fun(head2) + " contain the same reference " + ref1); } VirtualFile root1 = ref1.getRoot(); VirtualFile root2 = ref2.getRoot(); VcsLogRefManager refManager1 = myRefManagers.get(root1); VcsLogRefManager refManager2 = myRefManagers.get(root2); if (!refManager1.equals(refManager2)) { return refManager1.toString().compareTo(refManager2.toString()); } return refManager1.getBranchLayoutComparator().compare(ref1, ref2); }