bisect: limit considered set to descendants of first good rev
authorMatt Mackall <mpm@selenic.com>
Mon, 12 Oct 2009 14:59:28 -0500
changeset 9583 0491be4448bf
parent 9582 a25af3af941c
child 9584 17da88da1abd
bisect: limit considered set to descendants of first good rev
mercurial/hbisect.py
tests/test-bisect2.out
--- 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:
--- a/tests/test-bisect2.out	Mon Oct 12 14:52:53 2009 -0500
+++ b/tests/test-bisect2.out	Mon Oct 12 14:59:28 2009 -0500
@@ -201,12 +201,12 @@
 summary:     merge 10,13
 
 % complex bisect test 4
-Testing changeset 10:429fcd26f52d (13 changesets remaining, ~3 tests)
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-Testing changeset 13:b0a32c86eb31 (6 changesets remaining, ~2 tests)
+Testing changeset 13:b0a32c86eb31 (8 changesets remaining, ~3 tests)
+2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+Testing changeset 10:429fcd26f52d (5 changesets remaining, ~2 tests)
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
 Testing changeset 15:857b178a7cf3 (3 changesets remaining, ~1 tests)
-3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 Testing changeset 16:609d82a7ebae (3 changesets remaining, ~1 tests)
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 Due to skipped revisions, the first good revision could be any of: