# HG changeset patch # User Artem Tikhomirov # Date 1361213890 -3600 # Node ID 66fc86e8c0dd523916a8c837fdbbf27029654e28 # Parent cd78e8b9d7bca4cf7d1cca59785f2365542c4db3 #getFileRevision() shall accept TIP as an argument diff -r cd78e8b9d7bc -r 66fc86e8c0dd src/org/tmatesoft/hg/repo/HgManifest.java --- a/src/org/tmatesoft/hg/repo/HgManifest.java Mon Feb 18 19:19:48 2013 +0100 +++ b/src/org/tmatesoft/hg/repo/HgManifest.java Mon Feb 18 19:58:10 2013 +0100 @@ -256,9 +256,9 @@ // there's no need for HgDataFile to own this method, or get a delegate // as most of HgDataFile API is using file revision indexes, and there's easy step from file revision index to // both file revision and changeset revision index. But there's no easy way to go from changesetRevisionIndex to - // file revision (the task this method solves), exept for HgFileInformer + // file revision (the task this method solves), except for HgFileInformer // I feel methods dealing with changeset indexes shall be more exposed in HgChangelog and HgManifest API. - // TODO need tests + // TODO need tests (e.g. pass TIP here to see resMap.get(-1) doesn't fail) int manifestRevIndex = fromChangelog(changelogRevisionIndex); if (manifestRevIndex == BAD_REVISION) { return null; @@ -266,7 +266,9 @@ IntMap resMap = new IntMap(3); FileLookupInspector parser = new FileLookupInspector(encodingHelper, file, resMap, null); parser.walk(manifestRevIndex, content); - return resMap.get(changelogRevisionIndex); + assert resMap.size() == 1; + // can't use changelogRevisionIndex as key - it might have been TIP + return resMap.get(resMap.firstKey()); } /** @@ -308,7 +310,9 @@ IntMap resMap = new IntMap(2); FileLookupInspector parser = new FileLookupInspector(encodingHelper, file, null, resMap); parser.walk(manifestRevIdx, content); - return resMap.get(changesetRevIndex); + assert resMap.size() == 1; + // can't use changesetRevIndex as key - it might have been TIP + return resMap.get(resMap.firstKey()); }