diff mercurial/hbisect.py @ 9583:0491be4448bf

bisect: limit considered set to descendants of first good rev
author Matt Mackall <mpm@selenic.com>
date Mon, 12 Oct 2009 14:59:28 -0500
parents fc27c91fff2c
children 25e572394f5c
line wrap: on
line diff
--- a/mercurial/hbisect.py	Mon Oct 12 14:52:53 2009 -0500
+++ b/mercurial/hbisect.py	Mon Oct 12 14:59:28 2009 -0500
@@ -31,8 +31,16 @@
         # only the earliest bad revision matters
         badrev = min([changelog.rev(n) for n in bad])
         goodrevs = [changelog.rev(n) for n in good]
-        # build ancestors array
-        ancestors = [[]] * (len(changelog) + 1) # an extra for [-1]
+        goodrev = min(goodrevs)
+        # build visit array
+        ancestors = [None] * (len(changelog) + 1) # an extra for [-1]
+
+        # set nodes descended from goodrev
+        ancestors[goodrev] = []
+        for rev in xrange(goodrev + 1, len(changelog)):
+            for prev in clparents(rev):
+                if ancestors[prev] == []:
+                    ancestors[rev] = []
 
         # clear good revs from array
         for node in goodrevs: