D9337: errors: raise StateError in `hg bisect`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Nov 18 00:56:52 UTC 2020


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9337

AFFECTED FILES
  mercurial/hbisect.py
  tests/test-bisect.t

CHANGE DETAILS

diff --git a/tests/test-bisect.t b/tests/test-bisect.t
--- a/tests/test-bisect.t
+++ b/tests/test-bisect.t
@@ -364,7 +364,7 @@
   $ hg bisect -r
   $ hg bisect
   abort: cannot bisect (no known good revisions)
-  [255]
+  [20]
 
 
 reproduce AssertionError, issue1445
@@ -475,7 +475,7 @@
   $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
   changeset 31:58c80a7c8a40: good
   abort: cannot bisect (no known bad revisions)
-  [255]
+  [20]
   $ hg up -qr 0
   $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
   changeset 0:b99c7b9c8e11: bad
@@ -545,7 +545,7 @@
   $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
   changeset 31:58c80a7c8a40: good
   abort: cannot bisect (no known bad revisions)
-  [255]
+  [20]
   $ hg up -qr 0
   $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
   changeset 0:b99c7b9c8e11: bad
diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py
--- a/mercurial/hbisect.py
+++ b/mercurial/hbisect.py
@@ -172,13 +172,13 @@
 def checkstate(state):
     """check we have both 'good' and 'bad' to define a range
 
-    Raise Abort exception otherwise."""
+    Raise StateError exception otherwise."""
     if state[b'good'] and state[b'bad']:
         return True
     if not state[b'good']:
-        raise error.Abort(_(b'cannot bisect (no known good revisions)'))
+        raise error.StateError(_(b'cannot bisect (no known good revisions)'))
     else:
-        raise error.Abort(_(b'cannot bisect (no known bad revisions)'))
+        raise error.StateError(_(b'cannot bisect (no known bad revisions)'))
 
 
 @contextlib.contextmanager



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list