diff src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 282:e51dd9a14b6f

Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 03 Sep 2011 01:21:03 +0200
parents 81e9a3c9bafe
children 7232b94f2ae3
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgStatusCollector.java	Fri Sep 02 13:59:21 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgStatusCollector.java	Sat Sep 03 01:21:03 2011 +0200
@@ -170,11 +170,10 @@
 		walk(parents[0], rev, inspector);
 	}
 	
-	// I assume revision numbers are the same for changelog and manifest - here 
-	// user would like to pass changelog revision numbers, and I use them directly to walk manifest.
-	// if this assumption is wrong, fix this (lookup manifest revisions from changeset).
-	// rev1 and rev2 may be -1 to indicate comparison to empty repository
-	// argument order matters 
+	// rev1 and rev2 are changelog revision numbers, argument order matters.
+	// Either rev1 or rev2 may be -1 to indicate comparison to empty repository (XXX this is due to use of 
+	// parents in #change(), I believe. Perhaps, need a constant for this? Otherwise this hidden knowledge gets
+	// exposed to e.g. Record
 	public void walk(int rev1, int rev2, HgStatusInspector inspector) {
 		if (rev1 == rev2) {
 			throw new IllegalArgumentException();
@@ -182,9 +181,6 @@
 		if (inspector == null) {
 			throw new IllegalArgumentException();
 		}
-		if (inspector instanceof Record) {
-			((Record) inspector).init(rev1, rev2, this);
-		}
 		final int lastManifestRevision = repo.getChangelog().getLastRevision();
 		if (rev1 == TIP) {
 			rev1 = lastManifestRevision;
@@ -192,6 +188,9 @@
 		if (rev2 == TIP) {
 			rev2 = lastManifestRevision; 
 		}
+		if (inspector instanceof Record) {
+			((Record) inspector).init(rev1, rev2, this);
+		}
 		// in fact, rev1 and rev2 are often next (or close) to each other,
 		// thus, we can optimize Manifest reads here (manifest.walk(rev1, rev2))
 		ManifestRevision r1, r2 ;