Mercurial > hg
changeset 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 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon Jul 23 20:44:08 2007 -0500 +++ b/mercurial/revlog.py Mon Jul 23 20:44:08 2007 -0500 @@ -733,6 +733,17 @@ 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: