changeset 2489:568e58eed096

Add revlog.parentrevs function. This allows one to walk the revision graph using only revision numbers, which can be faster than using revision hashes, especially for RevlogNG, where the parents of a revision are stored as revision numbers.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 20 Jun 2006 14:57:30 -0300
parents 2785aeb51be4
children 6ff82ec1f4b8
files mercurial/revlog.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Jun 23 12:52:42 2006 -0700
+++ b/mercurial/revlog.py	Tue Jun 20 14:57:30 2006 -0300
@@ -477,6 +477,13 @@
         if self.version == REVLOGV0:
             return d
         return [ self.node(x) for x in d ]
+    def parentrevs(self, rev):
+        if rev == -1:
+            return (-1, -1)
+        d = self.index[rev][-3:-1]
+        if self.version == REVLOGV0:
+            return [ self.rev(x) for x in d ]
+        return d
     def start(self, rev):
         if rev < 0:
             return -1