bisect: only complain when nothing can be done
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Wed, 03 Sep 2008 19:00:43 +0200
changeset 6983 5ce625983208
parent 6982 9fc5bf4adbcf
child 6984 6c4a08270222
child 6990 ca6103c5eefd
bisect: only complain when nothing can be done
mercurial/commands.py
tests/test-bisect
tests/test-bisect.out
--- a/mercurial/commands.py	Wed Sep 03 19:01:35 2008 +0200
+++ b/mercurial/commands.py	Wed Sep 03 19:00:43 2008 +0200
@@ -286,9 +286,6 @@
             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 @@
         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)
--- a/tests/test-bisect	Wed Sep 03 19:01:35 2008 +0200
+++ b/tests/test-bisect	Wed Sep 03 19:00:43 2008 +0200
@@ -55,10 +55,7 @@
 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
 
-# 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
--- a/tests/test-bisect.out	Wed Sep 03 19:01:35 2008 +0200
+++ b/tests/test-bisect.out	Wed Sep 03 19:00:43 2008 +0200
@@ -241,8 +241,7 @@
 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 @@
 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 @@
 date:        Thu Jan 01 00:00:02 1970 +0000
 summary:     msg 2
 
+% test no action
+abort: cannot bisect (no known good revisions)