# HG changeset patch # User Dirkjan Ochtman # Date 2008-09-03 17:00:43 # Node ID 5ce625983208ee09ef583e7b23389de6032ae1d5 # Parent 9fc5bf4adbcf170c52c423ef4dd0bf8ae3cd7185 bisect: only complain when nothing can be done diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -286,9 +286,6 @@ def bisect(ui, repo, rev=None, extra=Non reset = True elif extra or good + bad + skip + reset > 1: raise util.Abort(_('incompatible arguments')) - elif not (good or bad or skip or reset): - ui.status(_('(no action selected)\n')) - return if reset: p = repo.join("bisect.state") @@ -327,7 +324,12 @@ def bisect(ui, repo, rev=None, extra=Non del wlock if not state['good'] or not state['bad']: - return + if (good or bad or skip or reset): + return + if not state['good']: + raise util.Abort(_('cannot bisect (no known good revisions)')) + else: + raise util.Abort(_('cannot bisect (no known bad revisions)')) # actually bisect nodes, changesets, good = hbisect.bisect(repo.changelog, state) diff --git a/tests/test-bisect b/tests/test-bisect --- a/tests/test-bisect +++ b/tests/test-bisect @@ -55,10 +55,7 @@ hg bisect -g null hg bisect -bU tip hg id -echo % test no action message -hg bisect - -# reproduce AssertionError (issue1228 and issue1182) +echo % reproduce AssertionError, issue1228 and issue1182 hg bisect -r hg bisect -b 4 hg bisect -g 0 @@ -66,8 +63,12 @@ hg bisect -s hg bisect -s hg bisect -s -# reproduce non converging bisect (issue1182) +echo % reproduce non converging bisect, issue1182 hg bisect -r hg bisect -g 0 hg bisect -b 2 hg bisect -s + +echo % test no action +hg bisect -r +hg bisect diff --git a/tests/test-bisect.out b/tests/test-bisect.out --- a/tests/test-bisect.out +++ b/tests/test-bisect.out @@ -241,8 +241,7 @@ abort: Inconsistent state, 31:58c80a7c8a error Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests) 5cd978ea5149 -% test no action message -(no action selected) +% reproduce AssertionError, issue1228 and issue1182 Testing changeset 2:db07c04beaca (4 changesets remaining, ~2 tests) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Testing changeset 1:5cd978ea5149 (4 changesets remaining, ~2 tests) @@ -270,6 +269,7 @@ user: test date: Thu Jan 01 00:00:04 1970 +0000 summary: msg 4 +% reproduce non converging bisect, issue1182 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Due to skipped revisions, the first bad revision could be any of: @@ -283,3 +283,5 @@ user: test date: Thu Jan 01 00:00:02 1970 +0000 summary: msg 2 +% test no action +abort: cannot bisect (no known good revisions)