Add optional stop revision to revlog.heads
authormason@suse.com
Sun, 14 Aug 2005 20:09:09 -0800
changeset 902 c749ca37aed1
parent 901 120cba94d5aa
child 903 71be6dd282d1
Add optional stop revision to revlog.heads
mercurial/revlog.py
--- 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