hbisect: do not assume that min(good) is an ancestor of min(bad)
authorAlexander Krauss <krauss@in.tum.de>
Sun, 17 Jul 2011 00:36:43 +0200
changeset 14895 a35d6f822e3e
parent 14894 3db92e3948d5
child 14896 1a841d2b4bb1
hbisect: do not assume that min(good) is an ancestor of min(bad) The included test used to report "inconsistent state", which is incorrect. While this situation cannot occur when the user sticks to the suggested bisect sequence. However, adding more consistent good/bad information to the bisect state should be tolerated as well.
mercurial/hbisect.py
tests/test-bisect2.t
--- a/mercurial/hbisect.py	Sun Jul 17 00:35:31 2011 +0200
+++ b/mercurial/hbisect.py	Sun Jul 17 00:36:43 2011 +0200
@@ -35,8 +35,9 @@
         # build visit array
         ancestors = [None] * (len(changelog) + 1) # an extra for [-1]
 
-        # set nodes descended from goodrev
-        ancestors[goodrev] = []
+        # set nodes descended from goodrevs
+        for rev in goodrevs:
+            ancestors[rev] = []
         for rev in xrange(goodrev + 1, len(changelog)):
             for prev in clparents(rev):
                 if ancestors[prev] == []:
--- a/tests/test-bisect2.t	Sun Jul 17 00:35:31 2011 +0200
+++ b/tests/test-bisect2.t	Sun Jul 17 00:36:43 2011 +0200
@@ -431,3 +431,22 @@
   date:        Thu Jan 01 00:00:09 1970 +0000
   summary:     9
   
+
+user adds irrelevant but consistent information (here: -g 2) to bisect state
+
+  $ hg bisect -r
+  $ hg bisect -b 13
+  $ hg bisect -g 8
+  Testing changeset 11:82ca6f06eccd (3 changesets remaining, ~1 tests)
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg bisect -g 2
+  Testing changeset 11:82ca6f06eccd (3 changesets remaining, ~1 tests)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg bisect -b
+  The first bad revision is:
+  changeset:   11:82ca6f06eccd
+  parent:      8:dab8161ac8fc
+  user:        test
+  date:        Thu Jan 01 00:00:11 1970 +0000
+  summary:     11
+