diff src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 337:f377f833b780

Issue 17: temporary code to nail down the problem
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 15 Nov 2011 03:07:28 +0100
parents 15e1961719f2
children a0864b2892cd
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Fri Nov 11 05:56:09 2011 +0100
+++ b/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Tue Nov 15 03:07:28 2011 +0100
@@ -30,6 +30,7 @@
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.tmatesoft.hg.core.HgBadStateException;
 import org.tmatesoft.hg.core.HgDataStreamException;
 import org.tmatesoft.hg.core.HgException;
 import org.tmatesoft.hg.core.Nodeid;
@@ -271,6 +272,10 @@
 				// size is the same or unknown, and, perhaps, different timestamp
 				// check actual content to avoid false modified files
 				HgDataFile df = repo.getFileNode(fname);
+				if (!df.exists()) {
+					String msg = String.format("File %s known as normal in dirstate (%d, %d), doesn't exist at %s", fname, r.modificationTime(), r.size(), repo.getStoragePath(df));
+					throw new HgBadStateException(msg);
+				}
 				Nodeid rev = getDirstateParentManifest().nodeid(fname);
 				// rev might be null here if fname comes to dirstate as a result of a merge operation
 				// where one of the parents (first parent) had no fname file, but second parent had.