Mercurial > hg-stable
changeset 902:c749ca37aed1
Add optional stop revision to revlog.heads
author | mason@suse.com |
---|---|
date | Sun, 14 Aug 2005 20:09:09 -0800 |
parents | 120cba94d5aa |
children | 71be6dd282d1 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Sun Aug 14 20:09:01 2005 -0800 +++ b/mercurial/revlog.py Sun Aug 14 20:09:09 2005 -0800 @@ -168,13 +168,21 @@ def end(self, rev): return self.start(rev) + self.length(rev) def base(self, rev): return self.index[rev][2] - def heads(self): + def heads(self, stop=None): p = {} h = [] + stoprev = 0 + if stop and stop in self.nodemap: + stoprev = self.rev(stop) + for r in range(self.count() - 1, -1, -1): n = self.node(r) if n not in p: h.append(n) + if n == stop: + break + if r < stoprev: + break for pn in self.parents(n): p[pn] = 1 return h