comparison mercurial/revlog.py @ 17673:d686c6876ef6

clfilter: handle non contiguous iteration in `revlov.headrevs` This prepares changelog level filtering. We can't assume that any revision can be heads because filtered revisions need to be excluded. New algorithm: - All revisions now start as "non heads", - every revision we iterate over is made candidate head, - parents of iterated revisions are definitely not head. Filtered revisions are never iterated over and never considered as candidate head.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 03 Sep 2012 14:12:45 +0200
parents 474047947b8f
children e69274f8d444
comparison
equal deleted inserted replaced
17672:474047947b8f 17673:d686c6876ef6
609 except AttributeError: 609 except AttributeError:
610 pass 610 pass
611 count = len(self) 611 count = len(self)
612 if not count: 612 if not count:
613 return [nullrev] 613 return [nullrev]
614 ishead = [1] * (count + 1) 614 # we won't iter over filtered rev so nobody is a head at start
615 ishead = [0] * (count + 1)
615 index = self.index 616 index = self.index
616 for r in self: 617 for r in self:
618 ishead[r] = 1 # I may be an head
617 e = index[r] 619 e = index[r]
618 ishead[e[5]] = ishead[e[6]] = 0 620 ishead[e[5]] = ishead[e[6]] = 0 # my parent are not
619 return [r for r in xrange(count) if ishead[r]] 621 return [r for r, val in enumerate(ishead) if val]
620 622
621 def heads(self, start=None, stop=None): 623 def heads(self, start=None, stop=None):
622 """return the list of all nodes that have no children 624 """return the list of all nodes that have no children
623 625
624 if start is specified, only heads that are descendants of 626 if start is specified, only heads that are descendants of