comparison mercurial/revlog.py @ 2490:6ff82ec1f4b8

Change revlog.heads to walk the revision graph using revision numbers On the kernel repo: $ hg heads -q before after RevlogNG 1.11 0.52 Revlogv0 0.80 0.69 Since the current code for tags has to find all the heads of the repo, this also helps there: $ hg tags before after RevlogNG 2.35 1.76 Revlogv0 2.04 1.90
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 20 Jun 2006 15:02:23 -0300
parents 568e58eed096
children c35694df7b13
comparison
equal deleted inserted replaced
2489:568e58eed096 2490:6ff82ec1f4b8
711 start will be returned 711 start will be returned
712 712
713 """ 713 """
714 if start is None: 714 if start is None:
715 start = nullid 715 start = nullid
716 reachable = {start: 1}
717 heads = {start: 1}
718 startrev = self.rev(start) 716 startrev = self.rev(start)
719 717 reachable = {startrev: 1}
718 heads = {startrev: 1}
719
720 parentrevs = self.parentrevs
720 for r in xrange(startrev + 1, self.count()): 721 for r in xrange(startrev + 1, self.count()):
721 n = self.node(r) 722 for p in parentrevs(r):
722 for pn in self.parents(n): 723 if p in reachable:
723 if pn in reachable: 724 reachable[r] = 1
724 reachable[n] = 1 725 heads[r] = 1
725 heads[n] = 1 726 if p in heads:
726 if pn in heads: 727 del heads[p]
727 del heads[pn] 728 return [self.node(r) for r in heads]
728 return heads.keys()
729 729
730 def children(self, node): 730 def children(self, node):
731 """find the children of a given node""" 731 """find the children of a given node"""
732 c = [] 732 c = []
733 p = self.rev(node) 733 p = self.rev(node)