mercurial/hbisect.py
changeset 9583 0491be4448bf
parent 8482 fc27c91fff2c
child 10263 25e572394f5c
--- 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: