Mercurial > hg4j
diff src/org/tmatesoft/hg/core/HgLogCommand.java @ 511:122e0600799f
Respect multiple joins/forks in a history of a single file
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 14 Dec 2012 15:39:49 +0100 |
parents | 90093ee56c0d |
children | 5dcb4581c8ef |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgLogCommand.java Thu Dec 13 15:46:40 2012 +0100 +++ b/src/org/tmatesoft/hg/core/HgLogCommand.java Fri Dec 14 15:39:49 2012 +0100 @@ -24,6 +24,7 @@ import java.util.Calendar; import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.LinkedList; @@ -541,6 +542,11 @@ queue.add(completeHistory[lastRevisionIndex]); do { HistoryNode withFileChange = queue.removeFirst(); + if (strippedHistoryList.contains(withFileChange)) { + // fork point for the change that was later merged (and we traced + // both lines of development by now. + continue; + } if (withFileChange.children != null) { withFileChange.children.retainAll(strippedHistoryList); } @@ -552,6 +558,12 @@ queue.addLast(withFileChange.parent2); } } while (!queue.isEmpty()); + Collections.sort(strippedHistoryList, new Comparator<HistoryNode>() { + + public int compare(HistoryNode o1, HistoryNode o2) { + return o1.changeset - o2.changeset; + } + }); completeHistory = null; commitRevisions = null; // collected values are no longer valid - shall @@ -666,6 +678,10 @@ child.parent1 = this; addChild(child); } + + public String toString() { + return String.format("<cset:%d, parents: %s, %s>", changeset, parent1 == null ? "-" : String.valueOf(parent1.changeset), parent2 == null ? "-" : String.valueOf(parent2.changeset)); + } } private class ElementImpl implements HgChangesetTreeHandler.TreeElement, HgChangelog.Inspector {