bisect: warn about ending on a merge with only one side marked
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Wed, 08 Sep 2010 13:48:25 +0200
changeset 12178 1ef9b0b5efec
parent 12177 80399b5b5f13
child 12179 1447d3a9ff4a
bisect: warn about ending on a merge with only one side marked
mercurial/commands.py
tests/test-bisect2.t
--- a/mercurial/commands.py	Wed Sep 08 12:53:15 2010 +0200
+++ b/mercurial/commands.py	Wed Sep 08 13:48:25 2010 +0200
@@ -336,6 +336,15 @@
             else:
                 ui.write(_("The first bad revision is:\n"))
             displayer.show(repo[nodes[0]])
+            parents = repo[nodes[0]].parents()
+            if len(parents) > 1:
+                side = state['bad'] if good else state['good']
+                num = len(set(i.node() for i in parents) & set(side))
+                if num == 1:
+                    common = parents[0].ancestor(parents[1])
+                    ui.write(_('Not all ancestors of this changeset have been'
+                               ' checked.\nTo check the other ancestors, start'
+                               ' from the common ancestor, %s.\n' % common))
         else:
             # multiple possible revisions
             if good:
--- a/tests/test-bisect2.t	Wed Sep 08 12:53:15 2010 +0200
+++ b/tests/test-bisect2.t	Wed Sep 08 13:48:25 2010 +0200
@@ -394,3 +394,35 @@
   $ hg bisect -g 14
   abort: starting revisions are not directly related
   $ hg bisect --reset
+
+end at merge: 17 bad, 11 good (but 9 is first bad)
+
+  $ hg bisect -r
+  $ hg bisect -b 17
+  $ hg bisect -g 11
+  Testing changeset 13:b0a32c86eb31 (5 changesets remaining, ~2 tests)
+  3 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg bisect -g
+  Testing changeset 15:857b178a7cf3 (3 changesets remaining, ~1 tests)
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg bisect -b
+  The first bad revision is:
+  changeset:   15:857b178a7cf3
+  parent:      13:b0a32c86eb31
+  parent:      10:429fcd26f52d
+  user:        test
+  date:        Thu Jan 01 00:00:15 1970 +0000
+  summary:     merge 10,13
+  
+  Not all ancestors of this changeset have been checked.
+  To check the other ancestors, start from the common ancestor, dab8161ac8fc.
+  $ hg bisect -g 8 # dab8161ac8fc
+  Testing changeset 9:3c77083deb4a (3 changesets remaining, ~1 tests)
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg bisect -b
+  The first bad revision is:
+  changeset:   9:3c77083deb4a
+  user:        test
+  date:        Thu Jan 01 00:00:09 1970 +0000
+  summary:     9
+