There will be about 1h of downtime on 2020-03-02 at 13:00 UTC+1 (change of servers and upgrade to Heptapod 0.20.0 final)

Commit 23f504f3 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk

errors: raise InputError in `hg absorb`

Differential Revision: https://phab.mercurial-scm.org/D9340
parent ac362d5a7893
Pipeline #12958 failed with stage
in 36 minutes and 25 seconds
...@@ -511,7 +511,7 @@ class filefixupstate(object): ...@@ -511,7 +511,7 @@ class filefixupstate(object):
# run editor # run editor
editedtext = self.ui.edit(editortext, b'', action=b'absorb') editedtext = self.ui.edit(editortext, b'', action=b'absorb')
if not editedtext: if not editedtext:
raise error.Abort(_(b'empty editor text')) raise error.InputError(_(b'empty editor text'))
# parse edited result # parse edited result
contents = [b''] * len(self.fctxs) contents = [b''] * len(self.fctxs)
leftpadpos = 4 leftpadpos = 4
...@@ -520,7 +520,7 @@ class filefixupstate(object): ...@@ -520,7 +520,7 @@ class filefixupstate(object):
if l.startswith(b'HG:'): if l.startswith(b'HG:'):
continue continue
if l[colonpos - 1 : colonpos + 2] != b' : ': 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 :] linecontent = l[colonpos + 2 :]
for i, ch in enumerate( for i, ch in enumerate(
pycompat.bytestr(l[leftpadpos : colonpos - 1]) pycompat.bytestr(l[leftpadpos : colonpos - 1])
...@@ -1018,7 +1018,7 @@ def absorb(ui, repo, stack=None, targetctx=None, pats=None, opts=None): ...@@ -1018,7 +1018,7 @@ def absorb(ui, repo, stack=None, targetctx=None, pats=None, opts=None):
limit = ui.configint(b'absorb', b'max-stack-size') limit = ui.configint(b'absorb', b'max-stack-size')
headctx = repo[b'.'] headctx = repo[b'.']
if len(headctx.parents()) > 1: 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) stack = getdraftstack(headctx, limit)
if limit and len(stack) >= limit: if limit and len(stack) >= limit:
ui.warn( ui.warn(
...@@ -1029,7 +1029,7 @@ def absorb(ui, repo, stack=None, targetctx=None, pats=None, opts=None): ...@@ -1029,7 +1029,7 @@ def absorb(ui, repo, stack=None, targetctx=None, pats=None, opts=None):
% limit % limit
) )
if not stack: 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 if targetctx is None: # default to working copy
targetctx = repo[None] targetctx = repo[None]
if pats is None: if pats is None:
......
...@@ -19,7 +19,7 @@ Do not crash with empty repo: ...@@ -19,7 +19,7 @@ Do not crash with empty repo:
$ hg absorb $ hg absorb
abort: no mutable changeset to change abort: no mutable changeset to change
[255] [10]
Make some commits: Make some commits:
...@@ -229,7 +229,7 @@ Public commits will not be changed: ...@@ -229,7 +229,7 @@ Public commits will not be changed:
$ sedi 's/Insert/insert/' a $ sedi 's/Insert/insert/' a
$ hg absorb --apply-changes $ hg absorb --apply-changes
abort: no mutable changeset to change abort: no mutable changeset to change
[255] [10]
Make working copy clean: Make working copy clean:
...@@ -267,7 +267,7 @@ Merge commit will not be changed: ...@@ -267,7 +267,7 @@ Merge commit will not be changed:
$ echo 2 >> m2 $ echo 2 >> m2
$ hg absorb --apply-changes $ hg absorb --apply-changes
abort: cannot absorb into a merge abort: cannot absorb into a merge
[255] [10]
$ hg revert -q -C m1 m2 $ hg revert -q -C m1 m2
Use a new repo: Use a new repo:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment