diff src/org/tmatesoft/hg/repo/HgManifest.java @ 550:c1478cc31f45

Regression: expect file to be missing in a manifest
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 19 Feb 2013 21:35:09 +0100
parents 66fc86e8c0dd
children e4ee4bf4c7d0
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgManifest.java	Tue Feb 19 21:17:39 2013 +0100
+++ b/src/org/tmatesoft/hg/repo/HgManifest.java	Tue Feb 19 21:35:09 2013 +0100
@@ -266,9 +266,9 @@
 		IntMap<Nodeid> resMap = new IntMap<Nodeid>(3);
 		FileLookupInspector parser = new FileLookupInspector(encodingHelper, file, resMap, null);
 		parser.walk(manifestRevIndex, content);
-		assert resMap.size() == 1;
+		assert resMap.size() <= 1; // size() == 0 if file wasn't found
 		// can't use changelogRevisionIndex as key - it might have been TIP
-		return resMap.get(resMap.firstKey());
+		return resMap.size() == 0 ? null : resMap.get(resMap.firstKey());
 	}
 	
 	/**
@@ -310,9 +310,9 @@
 		IntMap<Flags> resMap = new IntMap<Flags>(2);
 		FileLookupInspector parser = new FileLookupInspector(encodingHelper, file, null, resMap);
 		parser.walk(manifestRevIdx, content);
-		assert resMap.size() == 1;
+		assert resMap.size() <= 1; // size() == 0 if not found
 		// can't use changesetRevIndex as key - it might have been TIP
-		return resMap.get(resMap.firstKey());
+		return resMap.size() == 0 ? null : resMap.get(resMap.firstKey());
 	}