Mercurial > hg
comparison mercurial/revlog.py @ 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 | 16276b1c0658 |
children | 6ff82ec1f4b8 |
comparison
equal
deleted
inserted
replaced
2488:2785aeb51be4 | 2489:568e58eed096 |
---|---|
475 r = self.rev(node) | 475 r = self.rev(node) |
476 d = self.index[r][-3:-1] | 476 d = self.index[r][-3:-1] |
477 if self.version == REVLOGV0: | 477 if self.version == REVLOGV0: |
478 return d | 478 return d |
479 return [ self.node(x) for x in d ] | 479 return [ self.node(x) for x in d ] |
480 def parentrevs(self, rev): | |
481 if rev == -1: | |
482 return (-1, -1) | |
483 d = self.index[rev][-3:-1] | |
484 if self.version == REVLOGV0: | |
485 return [ self.rev(x) for x in d ] | |
486 return d | |
480 def start(self, rev): | 487 def start(self, rev): |
481 if rev < 0: | 488 if rev < 0: |
482 return -1 | 489 return -1 |
483 if self.version != REVLOGV0: | 490 if self.version != REVLOGV0: |
484 return self.ngoffset(self.index[rev][0]) | 491 return self.ngoffset(self.index[rev][0]) |