errors: use InputError in uncommit extension
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 29 Jan 2021 15:51:00 -0800
changeset 46465 0e2becd1fe0c
parent 46463 95b276283b67
child 46466 3e3b81b6e7da
errors: use InputError in uncommit extension Differential Revision: https://phab.mercurial-scm.org/D9911
hgext/uncommit.py
tests/test-unamend.t
tests/test-uncommit.t
--- a/hgext/uncommit.py	Mon Feb 01 11:41:10 2021 +0100
+++ b/hgext/uncommit.py	Fri Jan 29 15:51:00 2021 -0800
@@ -175,7 +175,7 @@
         old = repo[b'.']
         rewriteutil.precheck(repo, [old.rev()], b'uncommit')
         if len(old.parents()) > 1:
-            raise error.Abort(_(b"cannot uncommit merge changeset"))
+            raise error.InputError(_(b"cannot uncommit merge changeset"))
 
         match = scmutil.match(old, pats, opts)
 
@@ -202,7 +202,7 @@
                 else:
                     hint = _(b"file does not exist")
 
-                raise error.Abort(
+                raise error.InputError(
                     _(b'cannot uncommit "%s"') % scmutil.getuipathfn(repo)(f),
                     hint=hint,
                 )
@@ -280,7 +280,7 @@
         markers = list(predecessormarkers(curctx))
         if len(markers) != 1:
             e = _(b"changeset must have one predecessor, found %i predecessors")
-            raise error.Abort(e % len(markers))
+            raise error.InputError(e % len(markers))
 
         prednode = markers[0].prednode()
         predctx = unfi[prednode]
--- a/tests/test-unamend.t	Mon Feb 01 11:41:10 2021 +0100
+++ b/tests/test-unamend.t	Fri Jan 29 15:51:00 2021 -0800
@@ -39,7 +39,7 @@
 
   $ hg unamend
   abort: changeset must have one predecessor, found 0 predecessors
-  [255]
+  [10]
 
 Unamend on clean wdir and tip
 
--- a/tests/test-uncommit.t	Mon Feb 01 11:41:10 2021 +0100
+++ b/tests/test-uncommit.t	Fri Jan 29 15:51:00 2021 -0800
@@ -114,12 +114,12 @@
   $ hg uncommit nothinghere
   abort: cannot uncommit "nothinghere"
   (file does not exist)
-  [255]
+  [10]
   $ hg status
   $ hg uncommit file-abc
   abort: cannot uncommit "file-abc"
   (file was not changed in working directory parent)
-  [255]
+  [10]
   $ hg status
 
 Try partial uncommit, also moves bookmark
@@ -419,7 +419,7 @@
 
   $ hg uncommit
   abort: cannot uncommit merge changeset
-  [255]
+  [10]
 
   $ hg status
   $ hg log -G -T '{rev}:{node} {desc}' --hidden
@@ -585,12 +585,12 @@
   $ hg uncommit emptydir
   abort: cannot uncommit "emptydir"
   (file was untracked in working directory parent)
-  [255]
+  [10]
 
   $ cd emptydir
   $ hg uncommit .
   abort: cannot uncommit "emptydir"
   (file was untracked in working directory parent)
-  [255]
+  [10]
   $ hg status
   $ cd ..