Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/Revlog.java @ 80:4222b04f34ee
Follow history of a file
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 25 Jan 2011 03:54:32 +0100 |
parents | c677e1593919 |
children | 61eedab3eb3e |
comparison
equal
deleted
inserted
replaced
79:5f9635c01681 | 80:4222b04f34ee |
---|---|
14 * the terms of a license other than GNU General Public License | 14 * the terms of a license other than GNU General Public License |
15 * contact TMate Software at support@svnkit.com | 15 * contact TMate Software at support@svnkit.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.repo; | 17 package org.tmatesoft.hg.repo; |
18 | 18 |
19 import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION; | |
19 import static org.tmatesoft.hg.repo.HgRepository.TIP; | 20 import static org.tmatesoft.hg.repo.HgRepository.TIP; |
20 | 21 |
21 import java.util.Arrays; | 22 import java.util.Arrays; |
22 import java.util.Collection; | 23 import java.util.Collection; |
23 import java.util.Collections; | 24 import java.util.Collections; |
56 } | 57 } |
57 | 58 |
58 public int getRevisionCount() { | 59 public int getRevisionCount() { |
59 return content.revisionCount(); | 60 return content.revisionCount(); |
60 } | 61 } |
62 | |
63 public Nodeid getRevisionNumber(int revision) { | |
64 // XXX cache nodeids? | |
65 return Nodeid.fromBinary(content.nodeid(revision), 0); | |
66 } | |
61 | 67 |
62 public int getLocalRevisionNumber(Nodeid nid) { | 68 public int getLocalRevisionNumber(Nodeid nid) { |
63 int revision = content.findLocalRevisionNumber(nid); | 69 int revision = content.findLocalRevisionNumber(nid); |
64 if (revision == Integer.MIN_VALUE) { | 70 if (revision == BAD_REVISION) { |
65 throw new IllegalArgumentException(String.format("%s doesn't represent a revision of %s", nid.toString(), this /*XXX HgDataFile.getPath might be more suitable here*/)); | 71 throw new IllegalArgumentException(String.format("%s doesn't represent a revision of %s", nid.toString(), this /*XXX HgDataFile.getPath might be more suitable here*/)); |
66 } | 72 } |
67 return revision; | 73 return revision; |
68 } | 74 } |
69 | 75 |