# HG changeset patch # User Matt Mackall # Date 1185241448 18000 # Node ID 9c8c42bcf17a9aae8d5a695bbf07184d83973524 # Parent 4491125c0f2142b3b4be15e2320ac51c4586daf5 revlog: implement a fast path for heads diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -733,6 +733,17 @@ class revlog(object): if stop is specified, it will consider all the revs from stop as if they had no children """ + if start is None and stop is None: + count = self.count() + if not count: + return [nullid] + ishead = [1] * (count + 1) + index = self.index + for r in xrange(count): + e = index[r] + ishead[e[5]] = ishead[e[6]] = 0 + return [self.node(r) for r in xrange(count) if ishead[r]] + if start is None: start = nullid if stop is None: