errors: raise InputError in `hg absorb`
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 17 Nov 2020 16:23:57 -0800
changeset 45878 f4a218331ff4
parent 45877 ac362d5a7893
child 45879 5d73d3053d92
errors: raise InputError in `hg absorb` Differential Revision: https://phab.mercurial-scm.org/D9340
hgext/absorb.py
tests/test-absorb.t
--- a/hgext/absorb.py	Thu Oct 22 14:14:59 2020 -0700
+++ b/hgext/absorb.py	Tue Nov 17 16:23:57 2020 -0800
@@ -511,7 +511,7 @@
         # run editor
         editedtext = self.ui.edit(editortext, b'', action=b'absorb')
         if not editedtext:
-            raise error.Abort(_(b'empty editor text'))
+            raise error.InputError(_(b'empty editor text'))
         # parse edited result
         contents = [b''] * len(self.fctxs)
         leftpadpos = 4
@@ -520,7 +520,7 @@
             if l.startswith(b'HG:'):
                 continue
             if l[colonpos - 1 : colonpos + 2] != b' : ':
-                raise error.Abort(_(b'malformed line: %s') % l)
+                raise error.InputError(_(b'malformed line: %s') % l)
             linecontent = l[colonpos + 2 :]
             for i, ch in enumerate(
                 pycompat.bytestr(l[leftpadpos : colonpos - 1])
@@ -1018,7 +1018,7 @@
         limit = ui.configint(b'absorb', b'max-stack-size')
         headctx = repo[b'.']
         if len(headctx.parents()) > 1:
-            raise error.Abort(_(b'cannot absorb into a merge'))
+            raise error.InputError(_(b'cannot absorb into a merge'))
         stack = getdraftstack(headctx, limit)
         if limit and len(stack) >= limit:
             ui.warn(
@@ -1029,7 +1029,7 @@
                 % limit
             )
     if not stack:
-        raise error.Abort(_(b'no mutable changeset to change'))
+        raise error.InputError(_(b'no mutable changeset to change'))
     if targetctx is None:  # default to working copy
         targetctx = repo[None]
     if pats is None:
--- a/tests/test-absorb.t	Thu Oct 22 14:14:59 2020 -0700
+++ b/tests/test-absorb.t	Tue Nov 17 16:23:57 2020 -0800
@@ -19,7 +19,7 @@
 
   $ hg absorb
   abort: no mutable changeset to change
-  [255]
+  [10]
 
 Make some commits:
 
@@ -229,7 +229,7 @@
   $ sedi 's/Insert/insert/' a
   $ hg absorb --apply-changes
   abort: no mutable changeset to change
-  [255]
+  [10]
 
 Make working copy clean:
 
@@ -267,7 +267,7 @@
   $ echo 2 >> m2
   $ hg absorb --apply-changes
   abort: cannot absorb into a merge
-  [255]
+  [10]
   $ hg revert -q -C m1 m2
 
 Use a new repo: