changeset 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 83afa680555d
children 4ea0351ca878
files src/org/tmatesoft/hg/repo/HgManifest.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
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());
 	}