comparison mercurial/revlog.py @ 4991:9c8c42bcf17a

revlog: implement a fast path for heads
author Matt Mackall <mpm@selenic.com>
date Mon, 23 Jul 2007 20:44:08 -0500
parents 4491125c0f21
children 0a676643687b
comparison
equal deleted inserted replaced
4990:4491125c0f21 4991:9c8c42bcf17a
731 if start is specified, only heads that are descendants of 731 if start is specified, only heads that are descendants of
732 start will be returned 732 start will be returned
733 if stop is specified, it will consider all the revs from stop 733 if stop is specified, it will consider all the revs from stop
734 as if they had no children 734 as if they had no children
735 """ 735 """
736 if start is None and stop is None:
737 count = self.count()
738 if not count:
739 return [nullid]
740 ishead = [1] * (count + 1)
741 index = self.index
742 for r in xrange(count):
743 e = index[r]
744 ishead[e[5]] = ishead[e[6]] = 0
745 return [self.node(r) for r in xrange(count) if ishead[r]]
746
736 if start is None: 747 if start is None:
737 start = nullid 748 start = nullid
738 if stop is None: 749 if stop is None:
739 stop = [] 750 stop = []
740 stoprevs = dict.fromkeys([self.rev(n) for n in stop]) 751 stoprevs = dict.fromkeys([self.rev(n) for n in stop])