comparison test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java @ 426:063b0663495a

HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 28 Mar 2012 19:34:37 +0200
parents 6437d261048a
children 31a89587eb04
comparison
equal deleted inserted replaced
425:48f993aa2f41 426:063b0663495a
336 // Approach 2. No all-file map. Collect file revisions recorded at the time of tagging, 336 // Approach 2. No all-file map. Collect file revisions recorded at the time of tagging,
337 // then for each file revision check if it is among those above, and if yes, take corresponding tags 337 // then for each file revision check if it is among those above, and if yes, take corresponding tags
338 HgDataFile fileNode = repository.getFileNode(targetPath); 338 HgDataFile fileNode = repository.getFileNode(targetPath);
339 final long start2 = System.nanoTime(); 339 final long start2 = System.nanoTime();
340 final int lastRev = fileNode.getLastRevision(); 340 final int lastRev = fileNode.getLastRevision();
341 final Map<Integer, Nodeid> fileRevisionAtTagRevision = repository.getManifest().getFileRevisions(targetPath, tagLocalRevs); 341 final Map<Integer, Nodeid> fileRevisionAtTagRevision = new HashMap<Integer, Nodeid>();
342 HgManifest.Inspector collectFileRevAtCset = new HgManifest.Inspector() {
343
344 private int csetRevIndex;
345
346 public boolean next(Nodeid nid, Path fname, Flags flags) {
347 fileRevisionAtTagRevision.put(csetRevIndex, nid);
348 return true;
349 }
350
351 public boolean end(int manifestRevision) {
352 return true;
353 }
354
355 public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) {
356 csetRevIndex = changelogRevision;
357 return true;
358 }
359 };
360 repository.getManifest().walkFileRevisions(targetPath, collectFileRevAtCset,tagLocalRevs);
361
342 final long start2a = System.nanoTime(); 362 final long start2a = System.nanoTime();
343 fileNode.walk(0, lastRev, new HgDataFile.RevisionInspector() { 363 fileNode.walk(0, lastRev, new HgDataFile.RevisionInspector() {
344 364
345 public void next(int fileRevisionIndex, Nodeid fileRevision, int changesetRevisionIndex) { 365 public void next(int fileRevisionIndex, Nodeid fileRevision, int changesetRevisionIndex) {
346 List<String> associatedTags = new LinkedList<String>(); 366 List<String> associatedTags = new LinkedList<String>();