Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java @ 424:6437d261048a
Deprecated code removed
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 28 Mar 2012 15:42:15 +0200 |
parents | 9c9c442b5f2e |
children | 063b0663495a |
comparison
equal
deleted
inserted
replaced
423:9c9c442b5f2e | 424:6437d261048a |
---|---|
263 HgRepository repository = clogrmap.getRepo(); | 263 HgRepository repository = clogrmap.getRepo(); |
264 final long start = System.currentTimeMillis(); | 264 final long start = System.currentTimeMillis(); |
265 // file2rev2tag value is array of revisions, always of allTags.length. Revision index in the array | 265 // file2rev2tag value is array of revisions, always of allTags.length. Revision index in the array |
266 // is index of corresponding TagInfo in allTags; | 266 // is index of corresponding TagInfo in allTags; |
267 final Map<Path, Nodeid[]> file2rev2tag = new HashMap<Path, Nodeid[]>(); | 267 final Map<Path, Nodeid[]> file2rev2tag = new HashMap<Path, Nodeid[]>(); |
268 repository.getManifest().walk(new HgManifest.Inspector2() { | 268 repository.getManifest().walk(new HgManifest.Inspector() { |
269 private int[] tagIndexAtRev = new int[4]; // it's unlikely there would be a lot of tags associated with a given cset | 269 private int[] tagIndexAtRev = new int[4]; // it's unlikely there would be a lot of tags associated with a given cset |
270 | 270 |
271 public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) { | 271 public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) { |
272 // may do better here using tagLocalRev2TagInfo, but need to change a lot, too lazy now | 272 // may do better here using tagLocalRev2TagInfo, but need to change a lot, too lazy now |
273 Nodeid cset = clogrmap.revision(changelogRevision); | 273 Nodeid cset = clogrmap.revision(changelogRevision); |
286 } | 286 } |
287 if (tagIndexAtRev[0] == -1) { | 287 if (tagIndexAtRev[0] == -1) { |
288 System.out.println("Can't happen, provided we iterate over revisions with tags only"); | 288 System.out.println("Can't happen, provided we iterate over revisions with tags only"); |
289 } | 289 } |
290 return true; | 290 return true; |
291 } | |
292 | |
293 public boolean next(Nodeid nid, String fname, String flags) { | |
294 throw new IllegalStateException(HgManifest.Inspector2.class.getName()); | |
295 } | 291 } |
296 | 292 |
297 public boolean next(Nodeid nid, Path fname, HgManifest.Flags flags) { | 293 public boolean next(Nodeid nid, Path fname, HgManifest.Flags flags) { |
298 Nodeid[] m = file2rev2tag.get(fname); | 294 Nodeid[] m = file2rev2tag.get(fname); |
299 if (m == null) { | 295 if (m == null) { |
368 }); | 364 }); |
369 System.out.printf("Alternative total time: %d ms, of that init: %d ms\n", (System.nanoTime() - start2)/1000000, (start2a-start2)/1000000); | 365 System.out.printf("Alternative total time: %d ms, of that init: %d ms\n", (System.nanoTime() - start2)/1000000, (start2a-start2)/1000000); |
370 System.out.printf("Free mem: %,d\n", Runtime.getRuntime().freeMemory()); | 366 System.out.printf("Free mem: %,d\n", Runtime.getRuntime().freeMemory()); |
371 } | 367 } |
372 | 368 |
373 static class DoNothingManifestInspector implements HgManifest.Inspector2 { | 369 static class DoNothingManifestInspector implements HgManifest.Inspector { |
374 public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) { | 370 public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) { |
375 return true; | 371 return true; |
376 } | |
377 public boolean next(Nodeid nid, String fname, String flags) { | |
378 throw new IllegalStateException(HgManifest.Inspector2.class.getName()); | |
379 } | 372 } |
380 public boolean next(Nodeid nid, Path fname, Flags flags) { | 373 public boolean next(Nodeid nid, Path fname, Flags flags) { |
381 return true; | 374 return true; |
382 } | 375 } |
383 public boolean end(int manifestRevision) { | 376 public boolean end(int manifestRevision) { |