D9340: errors: raise InputError in `hg absorb`
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Nov 18 00:57:05 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/D9340
AFFECTED FILES
hgext/absorb.py
tests/test-absorb.t
CHANGE DETAILS
diff --git a/tests/test-absorb.t b/tests/test-absorb.t
--- a/tests/test-absorb.t
+++ b/tests/test-absorb.t
@@ -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:
diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -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:
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list