changeset 222:373e07cd3991

Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 19 May 2011 05:02:07 +0200
parents 04735ce6bed2
children 80a3433ace91
files cmdline/org/tmatesoft/hg/console/Main.java src/org/tmatesoft/hg/core/HgManifestCommand.java src/org/tmatesoft/hg/repo/HgManifest.java src/org/tmatesoft/hg/repo/HgStatusCollector.java
diffstat 4 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java	Thu May 19 04:45:52 2011 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Main.java	Thu May 19 05:02:07 2011 +0200
@@ -143,8 +143,8 @@
 	}
 
 	public static final class ManifestDump implements HgManifest.Inspector {
-		public boolean begin(int revision, Nodeid nid) {
-			System.out.printf("%d : %s\n", revision, nid);
+		public boolean begin(int manifestRevision, Nodeid nid, int changelogRevision) {
+			System.out.printf("%d : %s\n", manifestRevision, nid);
 			return true;
 		}
 
--- a/src/org/tmatesoft/hg/core/HgManifestCommand.java	Thu May 19 04:45:52 2011 +0200
+++ b/src/org/tmatesoft/hg/core/HgManifestCommand.java	Thu May 19 05:02:07 2011 +0200
@@ -147,7 +147,7 @@
 			pathPool = null;
 		}
 	
-		public boolean begin(int revision, Nodeid nid) {
+		public boolean begin(int manifestRevision, Nodeid nid, int changelogRevision) {
 			if (needDirs && manifestContent == null) {
 				manifestContent = new LinkedList<FileRevision>();
 			}
--- a/src/org/tmatesoft/hg/repo/HgManifest.java	Thu May 19 04:45:52 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgManifest.java	Thu May 19 05:02:07 2011 +0200
@@ -69,9 +69,9 @@
 	}
 	
 	public interface Inspector {
-		boolean begin(int revision, Nodeid nid);
+		boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision);
 		boolean next(Nodeid nid, String fname, String flags);
-		boolean end(int revision);
+		boolean end(int manifestRevision);
 	}
 
 	private static class ManifestParser implements RevlogStream.Inspector {
@@ -94,7 +94,7 @@
 				return;
 			}
 			try {
-				gtg = gtg && inspector.begin(revisionNumber, new Nodeid(nodeid, true));
+				gtg = gtg && inspector.begin(revisionNumber, new Nodeid(nodeid, true), linkRevision);
 				int i;
 				String fname = null;
 				String flags = null;
--- a/src/org/tmatesoft/hg/repo/HgStatusCollector.java	Thu May 19 04:45:52 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgStatusCollector.java	Thu May 19 05:02:07 2011 +0200
@@ -65,7 +65,7 @@
 		cacheFilenames = new Pool<String>();
 
 		emptyFakeState = new ManifestRevisionInspector(null, null);
-		emptyFakeState.begin(-1, null);
+		emptyFakeState.begin(-1, null, -1);
 		emptyFakeState.end(-1);
 	}
 	
@@ -103,15 +103,15 @@
 			private ManifestRevisionInspector delegate;
 			private boolean cacheHit; // range may include revisions we already know about, do not re-create them
 
-			public boolean begin(int revision, Nodeid nid) {
+			public boolean begin(int manifestRevision, Nodeid nid, int changelogRevision) {
 				assert delegate == null;
-				if (cache.containsKey(revision)) { // don't need to check emptyFakeState hit as revision never -1 here
+				if (cache.containsKey(changelogRevision)) { // don't need to check emptyFakeState hit as revision never -1 here
 					cacheHit = true;
 				} else {
-					cache.put(revision, delegate = new ManifestRevisionInspector(cacheNodes, cacheFilenames));
+					cache.put(changelogRevision, delegate = new ManifestRevisionInspector(cacheNodes, cacheFilenames));
 					// cache may grow bigger than max size here, but it's ok as present simplistic cache clearing mechanism may
 					// otherwise remove entries we just added
-					delegate.begin(revision, nid);
+					delegate.begin(manifestRevision, nid, changelogRevision);
 					cacheHit = false;
 				}
 				return true;
@@ -458,7 +458,7 @@
 			return false; 
 		}
 
-		public boolean begin(int revision, Nodeid nid) {
+		public boolean begin(int revision, Nodeid nid, int changelogRevision) {
 			return true;
 		}
 	}