Mercurial > hg4j
diff test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java @ 367:2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 16 Dec 2011 15:37:27 +0100 |
parents | 189dc6dc1c3e |
children | 8107b95f4280 |
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java Fri Dec 16 04:43:18 2011 +0100 +++ b/test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java Fri Dec 16 15:37:27 2011 +0100 @@ -97,7 +97,7 @@ for (int revision = 0; revision <= latestRevision; revision++) { final Nodeid nodeId = fileMap.revision(revision); // final Nodeid changesetId = fileNode.getChangesetRevision(nodeId); - int localCset = fileNode.getChangesetLocalRevision(revision); + int localCset = fileNode.getChangesetRevisionIndex(revision); final Nodeid changesetId = clog.getRevision(localCset); changesetToNodeid_1.put(changesetId, nodeId); } @@ -110,7 +110,7 @@ final long start_2a = System.nanoTime(); for (int revision = 0; revision <= latestRevision; revision++) { Nodeid nidFile = fileMap.revision(revision); - int localCset = fileNode.getChangesetLocalRevision(revision); + int localCset = fileNode.getChangesetRevisionIndex(revision); Nodeid nidCset = clogMap.revision(localCset); changesetToNodeid_2.put(nidCset, nidFile); } @@ -138,8 +138,8 @@ /* * Each 5000 revisions from cpython, total 15 revisions - * Direct clog.getLocalRevision: ~260 ms - * RevisionMap.localRevision: ~265 ms (almost 100% in #init()) + * Direct clog.getRevisionIndex: ~260 ms + * RevisionMap.revisionIndex: ~265 ms (almost 100% in #init()) * each 1000'th revision, total 71 revision: 1 230 vs 270 * each 2000'th revision, total 36 revision: 620 vs 270 * each 3000'th revision, total 24 revision: 410 vs 275 @@ -154,7 +154,7 @@ } final long s1 = System.nanoTime(); for (Nodeid n : revisions) { - int r = clog.getLocalRevision(n); + int r = clog.getRevisionIndex(n); if (r % step != 0) { throw new IllegalStateException(Integer.toString(r)); } @@ -165,7 +165,7 @@ rmap.init(); final long s3 = System.nanoTime(); for (Nodeid n : revisions) { - int r = rmap.localRevision(n); + int r = rmap.revisionIndex(n); if (r % step != 0) { throw new IllegalStateException(Integer.toString(r)); } @@ -216,7 +216,7 @@ int x = 0; for (int i = 0; i < allTags.length; i++) { final Nodeid tagRevision = allTags[i].revision(); - final int tagLocalRev = clogrmap.localRevision(tagRevision); + final int tagLocalRev = clogrmap.revisionIndex(tagRevision); if (tagLocalRev != HgRepository.BAD_REVISION) { tagLocalRevs[x++] = tagLocalRev; List<TagInfo> tagsAssociatedWithRevision = tagLocalRev2TagInfo.get(tagLocalRev); @@ -328,7 +328,7 @@ // TODO if fileNode.isCopy, repeat for each getCopySourceName() for (int localFileRev = 0; localFileRev < fileNode.getRevisionCount(); localFileRev++) { Nodeid fileRev = fileNode.getRevision(localFileRev); - int changesetLocalRev = fileNode.getChangesetLocalRevision(localFileRev); + int changesetLocalRev = fileNode.getChangesetRevisionIndex(localFileRev); List<String> associatedTags = new LinkedList<String>(); for (int i = 0; i < allTagsOfTheFile.length; i++) { if (fileRev.equals(allTagsOfTheFile[i])) { @@ -402,7 +402,7 @@ final HgTags.TagInfo info = tagToInfo.get(tagName); final Nodeid nodeId = info.revision(); // TODO: This is not correct as we can't be sure that file at the corresponding revision is actually our target file (which may have been renamed, etc.) - final Nodeid fileRevision = manifest.getFileRevision(repository.getChangelog().getLocalRevision(nodeId), targetPath); + final Nodeid fileRevision = manifest.getFileRevision(repository.getChangelog().getRevisionIndex(nodeId), targetPath); if (fileRevision == null) { continue; }