Mercurial > jhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 549:83afa680555d | 550:c1478cc31f45 |
|---|---|
| 264 return null; | 264 return null; |
| 265 } | 265 } |
| 266 IntMap<Nodeid> resMap = new IntMap<Nodeid>(3); | 266 IntMap<Nodeid> resMap = new IntMap<Nodeid>(3); |
| 267 FileLookupInspector parser = new FileLookupInspector(encodingHelper, file, resMap, null); | 267 FileLookupInspector parser = new FileLookupInspector(encodingHelper, file, resMap, null); |
| 268 parser.walk(manifestRevIndex, content); | 268 parser.walk(manifestRevIndex, content); |
| 269 assert resMap.size() == 1; | 269 assert resMap.size() <= 1; // size() == 0 if file wasn't found |
| 270 // can't use changelogRevisionIndex as key - it might have been TIP | 270 // can't use changelogRevisionIndex as key - it might have been TIP |
| 271 return resMap.get(resMap.firstKey()); | 271 return resMap.size() == 0 ? null : resMap.get(resMap.firstKey()); |
| 272 } | 272 } |
| 273 | 273 |
| 274 /** | 274 /** |
| 275 * Visit file revisions as they were recorded at the time of given changesets. Same file revision may be reported as many times as | 275 * Visit file revisions as they were recorded at the time of given changesets. Same file revision may be reported as many times as |
| 276 * there are changesets that refer to that revision. Both {@link Inspector#begin(int, Nodeid, int)} and {@link Inspector#end(int)} | 276 * there are changesets that refer to that revision. Both {@link Inspector#begin(int, Nodeid, int)} and {@link Inspector#end(int)} |
| 308 public Flags getFileFlags(int changesetRevIndex, Path file) throws HgInvalidRevisionException, HgInvalidControlFileException { | 308 public Flags getFileFlags(int changesetRevIndex, Path file) throws HgInvalidRevisionException, HgInvalidControlFileException { |
| 309 int manifestRevIdx = fromChangelog(changesetRevIndex); | 309 int manifestRevIdx = fromChangelog(changesetRevIndex); |
| 310 IntMap<Flags> resMap = new IntMap<Flags>(2); | 310 IntMap<Flags> resMap = new IntMap<Flags>(2); |
| 311 FileLookupInspector parser = new FileLookupInspector(encodingHelper, file, null, resMap); | 311 FileLookupInspector parser = new FileLookupInspector(encodingHelper, file, null, resMap); |
| 312 parser.walk(manifestRevIdx, content); | 312 parser.walk(manifestRevIdx, content); |
| 313 assert resMap.size() == 1; | 313 assert resMap.size() <= 1; // size() == 0 if not found |
| 314 // can't use changesetRevIndex as key - it might have been TIP | 314 // can't use changesetRevIndex as key - it might have been TIP |
| 315 return resMap.get(resMap.firstKey()); | 315 return resMap.size() == 0 ? null : resMap.get(resMap.firstKey()); |
| 316 } | 316 } |
| 317 | 317 |
| 318 | 318 |
| 319 /** | 319 /** |
| 320 * @param changelogRevisionIndexes non-null | 320 * @param changelogRevisionIndexes non-null |
