diff src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java @ 314:fb74133d2025

Issue 14: NPE for merged dirstate and a file missed in dirstate's first parent
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 27 Sep 2011 06:34:54 +0200
parents 981f9f50bb6c
children 4c7e3ba67213
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Tue Sep 27 05:57:30 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.java	Tue Sep 27 06:34:54 2011 +0200
@@ -272,7 +272,11 @@
 				// check actual content to avoid false modified files
 				HgDataFile df = repo.getFileNode(fname);
 				Nodeid rev = getDirstateParentManifest().nodeid(fname);
-				if (!areTheSame(f, df, rev)) {
+				// 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.
+				// E.g. fork revision 3, revision 4 gets .hgtags, few modifications and merge(3,12)
+				// see Issue 14 for details
+				if (rev == null || !areTheSame(f, df, rev)) {
 					inspector.modified(df.getPath());
 				} else {
 					inspector.clean(df.getPath());