diff src/org/tmatesoft/hg/repo/HgBlameFacility.java @ 561:d3c71498919c

Do not process child revisions before all possible parent paths were visited
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 27 Feb 2013 19:37:58 +0100
parents 154718ae23ed
children 6fbca6506bb5
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgBlameFacility.java	Tue Feb 26 21:06:43 2013 +0100
+++ b/src/org/tmatesoft/hg/repo/HgBlameFacility.java	Wed Feb 27 19:37:58 2013 +0100
@@ -80,7 +80,9 @@
 			df.parents(i, fileRevParents, null, null);
 			fileParentRevs.add(fileRevParents[0], fileRevParents[1]);
 		}
-		// collect file revisions to visit, from newest to oldest
+		// collect file revisions to visit, from newest to oldest:
+		// traverse parents, starting from the given file revision
+		// this ignores all file revision made in parallel to the one of interest
 		IntVector fileRevsToVisit = new IntVector(fileRevIndex + 1, 0);
 		LinkedList<Integer> queue = new LinkedList<Integer>();
 		BitSet seen = new BitSet(fileRevIndex + 1);
@@ -102,6 +104,8 @@
 			}
 		} while (!queue.isEmpty());
 		FileLinesCache fileInfoCache = new FileLinesCache(df, 10);
+		// make sure no child is processed before we handled all (grand-)parents of the element
+		fileRevsToVisit.sort(false);
 		// fileRevsToVisit now { r10, r7, r6, r5, r0 }
 		// and we'll iterate it from behind, e.g. old to new unless reversed 
 		if (iterateOrder == HgIterateDirection.NewToOld) {