# HG changeset patch # User Alexis S. L. Carvalho # Date 2006-06-20 17:57:30 # Node ID 568e58eed096e832cc1a2f02b70b80a4ea9cac99 # Parent 2785aeb51be43492601aaf7883c1e442f5123d02 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. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -477,6 +477,13 @@ class revlog(object): 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