Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 3923:27230c29bfec 0.9.3
fix calculation of new heads added during push with -r
fix issue450
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 17 Dec 2006 05:00:22 +0100 |
parents | 05120e210c65 |
children | 4df475e22248 90bb1ab53a85 |
line wrap: on
line diff
--- a/mercurial/revlog.py Sat Dec 16 23:33:24 2006 +0100 +++ b/mercurial/revlog.py Sun Dec 17 05:00:22 2006 +0100 @@ -717,15 +717,19 @@ assert heads return (orderedout, roots, heads) - def heads(self, start=None): + def heads(self, start=None, stop=None): """return the list of all nodes that have no children if start is specified, only heads that are descendants of start will be returned - + if stop is specified, it will consider all the revs from stop + as if they had no children """ if start is None: start = nullid + if stop is None: + stop = [] + stoprevs = dict.fromkeys([self.rev(n) for n in stop]) startrev = self.rev(start) reachable = {startrev: 1} heads = {startrev: 1} @@ -734,10 +738,12 @@ for r in xrange(startrev + 1, self.count()): for p in parentrevs(r): if p in reachable: - reachable[r] = 1 + if r not in stoprevs: + reachable[r] = 1 heads[r] = 1 - if p in heads: + if p in heads and p not in stoprevs: del heads[p] + return [self.node(r) for r in heads] def children(self, node):