mercurial/revlog.py
changeset 2490 6ff82ec1f4b8
parent 2489 568e58eed096
child 2560 c35694df7b13
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)