# HG changeset patch # User Dirkjan Ochtman # Date 2010-09-08 11:48:25 # Node ID 1ef9b0b5efec2f8a026dfdd79e9356bc5d56d9e5 # Parent 80399b5b5f1392693ddf13caf3511aeb248414de bisect: warn about ending on a merge with only one side marked diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -336,6 +336,15 @@ def bisect(ui, repo, rev=None, extra=Non 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: diff --git a/tests/test-bisect2.t b/tests/test-bisect2.t --- a/tests/test-bisect2.t +++ b/tests/test-bisect2.t @@ -394,3 +394,35 @@ test unrelated revs: $ 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 +