This instance will be upgraded to Heptapod 0.21.0rc3 on 2021-04-23 at 10:30 UTC+2 (a few minutes of down time)

Commit 7faf63fa authored by Martin von Zweigbergk's avatar Martin von Zweigbergk

errors: raise more specific errors from rewriteutil

Differential Revision: https://phab.mercurial-scm.org/D9330
parent b56feaa9b520
......@@ -33,20 +33,20 @@ def precheck(repo, revs, action=b'rewrite'):
if node.nullrev in revs:
msg = _(b"cannot %s null changeset") % action
hint = _(b"no changeset checked out")
raise error.Abort(msg, hint=hint)
raise error.InputError(msg, hint=hint)
if len(repo[None].parents()) > 1:
raise error.Abort(_(b"cannot %s while merging") % action)
raise error.StateError(_(b"cannot %s while merging") % action)
publicrevs = repo.revs(b'%ld and public()', revs)
if publicrevs:
msg = _(b"cannot %s public changesets") % action
hint = _(b"see 'hg help phases' for details")
raise error.Abort(msg, hint=hint)
raise error.InputError(msg, hint=hint)
newunstable = disallowednewunstable(repo, revs)
if newunstable:
raise error.Abort(_(b"cannot %s changeset with children") % action)
raise error.InputError(_(b"cannot %s changeset with children") % action)
def disallowednewunstable(repo, revs):
......
......@@ -197,7 +197,7 @@ Amend in the middle of a stack
$ echo 2 >> B
$ hg amend
abort: cannot amend changeset with children
[255]
[10]
#if obsstore-on
......@@ -240,7 +240,7 @@ Cannot amend public changeset
$ hg amend -m AMEND
abort: cannot amend public changesets
(see 'hg help phases' for details)
[255]
[10]
Amend a merge changeset
......
......@@ -58,7 +58,7 @@ Change in middle of the stack (linear commits)
$ hg branch -r 1::3 foo
abort: cannot change branch of changeset with children
[255]
[10]
Change with dirty working directory
......@@ -129,7 +129,7 @@ Changing on a branch head which is not topological head
$ hg branch -r 2 stable
abort: cannot change branch of changeset with children
[255]
[10]
Enabling the allowunstable config and trying to change branch on a branch head
which is not a topological head
......@@ -368,7 +368,7 @@ Changing branch on public changeset
$ hg branch -r . def
abort: cannot change branch of public changesets
(see 'hg help phases' for details)
[255]
[10]
Merge commit with conflicts, with evolution and without
......
......@@ -12,7 +12,7 @@ Refuse to amend public csets:
$ hg ci --amend
abort: cannot amend public changesets
(see 'hg help phases' for details)
[255]
[10]
$ hg phase -r . -f -d
$ echo a >> a
......@@ -407,7 +407,7 @@ Refuse to amend during a merge:
(branch merge, don't forget to commit)
$ hg ci --amend
abort: cannot amend while merging
[255]
[20]
$ hg ci -m 'merge'
Refuse to amend if there is a merge conflict (issue5805):
......
......@@ -266,11 +266,11 @@ nothing happens, even to the working directory.
$ hg fix -r 0
abort: cannot fix public changesets
(see 'hg help phases' for details)
[255]
[10]
$ hg fix -r 0 --working-dir
abort: cannot fix public changesets
(see 'hg help phases' for details)
[255]
[10]
$ hg cat -r tip hello.whole
hello
$ cat hello.whole
......@@ -1174,7 +1174,7 @@ an orphan. We must respect experimental.evolution.allowunstable.
$ hg commit -m "second"
$ hg --config experimental.evolution.allowunstable=False fix -r '.^'
abort: cannot fix changeset with children
[255]
[10]
$ hg fix -r '.^'
1 new orphan changesets
$ hg cat -r 2 foo.whole
......
......@@ -309,7 +309,7 @@ Check that histedit respect immutability
$ hg histedit -r '.~2'
abort: cannot edit public changesets
(see 'hg help phases' for details)
[255]
[10]
Prepare further testing
......
......@@ -551,7 +551,7 @@ Test collapsing a middle revision in-place
$ hg rebase --collapse -r 1 -d 0
abort: cannot rebase changeset with children
(use --keep to keep original changesets)
[255]
[10]
Test collapsing in place
......
......@@ -327,15 +327,15 @@ Check rebasing public changeset
$ hg rebase -d 0 -b 6
abort: cannot rebase public changesets
(see 'hg help phases' for details)
[255]
[10]
$ hg rebase -d 5 -b 6
abort: cannot rebase public changesets
(see 'hg help phases' for details)
[255]
[10]
$ hg rebase -d 5 -r '1 + (6::)'
abort: cannot rebase public changesets
(see 'hg help phases' for details)
[255]
[10]
$ hg rebase -d 5 -b 6 --keep
rebasing 6:e1c4361dd923 "C"
......@@ -455,7 +455,7 @@ Source on have two descendant heads but ask for one
$ hg rebase -r '2::8' -d 1
abort: cannot rebase changeset with children
(use --keep to keep original changesets)
[255]
[10]
$ hg rebase -r '2::8' -d 1 -k
rebasing 2:c9e50f6cdc55 "C"
rebasing 3:ffd453c31098 "D"
......@@ -501,7 +501,7 @@ Base on have one descendant heads we ask for but common ancestor have two
$ hg rebase -r '3::8' -d 1
abort: cannot rebase changeset with children
(use --keep to keep original changesets)
[255]
[10]
$ hg rebase -r '3::8' -d 1 --keep
rebasing 3:ffd453c31098 "D"
rebasing 6:3d8a618087a7 "G"
......@@ -544,7 +544,7 @@ rebase subset
$ hg rebase -r '3::7' -d 1
abort: cannot rebase changeset with children
(use --keep to keep original changesets)
[255]
[10]
$ hg rebase -r '3::7' -d 1 --keep
rebasing 3:ffd453c31098 "D"
rebasing 6:3d8a618087a7 "G"
......@@ -584,7 +584,7 @@ rebase subset with multiple head
$ hg rebase -r '3::(7+5)' -d 1
abort: cannot rebase changeset with children
(use --keep to keep original changesets)
[255]
[10]
$ hg rebase -r '3::(7+5)' -d 1 --keep
rebasing 3:ffd453c31098 "D"
rebasing 4:c01897464e7f "E"
......
......@@ -79,7 +79,7 @@ Cannot split a public changeset
$ hg split .
abort: cannot split public changesets
(see 'hg help phases' for details)
[255]
[10]
$ hg phase --draft -f -r 'all()'
......@@ -467,7 +467,7 @@ Split a non-head without rebase
#if obsstore-off
$ runsplit -r 1 --no-rebase
abort: cannot split changeset with children
[255]
[10]
#else
$ runsplit -r 1 --no-rebase >/dev/null
3 new orphan changesets
......@@ -518,7 +518,7 @@ Split a non-head with obsoleted descendants
$ rm .hg/localtags
$ hg split $B --config experimental.evolution=createmarkers
abort: cannot split changeset with children
[255]
[10]
$ cat > $TESTTMP/messages <<EOF
> Split B
> EOF
......
......@@ -284,7 +284,7 @@ Unamending in middle of a stack
$ hg --config experimental.evolution=createmarkers unamend
abort: cannot unamend changeset with children
[255]
[10]
$ hg unamend
3 new orphan changesets
......@@ -298,7 +298,7 @@ Trying to unamend a public changeset
$ hg unamend
abort: cannot unamend public changesets
(see 'hg help phases' for details)
[255]
[10]
Testing whether unamend retains copies or not
......
......@@ -53,7 +53,7 @@ Uncommit with no commits should fail
$ hg uncommit
abort: cannot uncommit null changeset
(no changeset checked out)
[255]
[10]
Create some commits
......@@ -411,7 +411,7 @@ Add and expect uncommit to fail on both merge working dir and merge changeset
$ hg uncommit --config experimental.uncommitondirtywdir=True
abort: cannot uncommit while merging
[255]
[20]
$ hg status
M a
......
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