##// END OF EJS Templates
errors: raise more specific errors from rewriteutil...
Martin von Zweigbergk -
r46457:b4694ef4 default
parent child Browse files
Show More
@@ -33,20 +33,20 b" def precheck(repo, revs, action=b'rewrit"
33 if node.nullrev in revs:
33 if node.nullrev in revs:
34 msg = _(b"cannot %s null changeset") % action
34 msg = _(b"cannot %s null changeset") % action
35 hint = _(b"no changeset checked out")
35 hint = _(b"no changeset checked out")
36 raise error.Abort(msg, hint=hint)
36 raise error.InputError(msg, hint=hint)
37
37
38 if len(repo[None].parents()) > 1:
38 if len(repo[None].parents()) > 1:
39 raise error.Abort(_(b"cannot %s while merging") % action)
39 raise error.StateError(_(b"cannot %s while merging") % action)
40
40
41 publicrevs = repo.revs(b'%ld and public()', revs)
41 publicrevs = repo.revs(b'%ld and public()', revs)
42 if publicrevs:
42 if publicrevs:
43 msg = _(b"cannot %s public changesets") % action
43 msg = _(b"cannot %s public changesets") % action
44 hint = _(b"see 'hg help phases' for details")
44 hint = _(b"see 'hg help phases' for details")
45 raise error.Abort(msg, hint=hint)
45 raise error.InputError(msg, hint=hint)
46
46
47 newunstable = disallowednewunstable(repo, revs)
47 newunstable = disallowednewunstable(repo, revs)
48 if newunstable:
48 if newunstable:
49 raise error.Abort(_(b"cannot %s changeset with children") % action)
49 raise error.InputError(_(b"cannot %s changeset with children") % action)
50
50
51
51
52 def disallowednewunstable(repo, revs):
52 def disallowednewunstable(repo, revs):
@@ -197,7 +197,7 b' Amend in the middle of a stack'
197 $ echo 2 >> B
197 $ echo 2 >> B
198 $ hg amend
198 $ hg amend
199 abort: cannot amend changeset with children
199 abort: cannot amend changeset with children
200 [255]
200 [10]
201
201
202 #if obsstore-on
202 #if obsstore-on
203
203
@@ -240,7 +240,7 b' Cannot amend public changeset'
240 $ hg amend -m AMEND
240 $ hg amend -m AMEND
241 abort: cannot amend public changesets
241 abort: cannot amend public changesets
242 (see 'hg help phases' for details)
242 (see 'hg help phases' for details)
243 [255]
243 [10]
244
244
245 Amend a merge changeset
245 Amend a merge changeset
246
246
@@ -58,7 +58,7 b' Change in middle of the stack (linear co'
58
58
59 $ hg branch -r 1::3 foo
59 $ hg branch -r 1::3 foo
60 abort: cannot change branch of changeset with children
60 abort: cannot change branch of changeset with children
61 [255]
61 [10]
62
62
63 Change with dirty working directory
63 Change with dirty working directory
64
64
@@ -129,7 +129,7 b' Changing on a branch head which is not t'
129
129
130 $ hg branch -r 2 stable
130 $ hg branch -r 2 stable
131 abort: cannot change branch of changeset with children
131 abort: cannot change branch of changeset with children
132 [255]
132 [10]
133
133
134 Enabling the allowunstable config and trying to change branch on a branch head
134 Enabling the allowunstable config and trying to change branch on a branch head
135 which is not a topological head
135 which is not a topological head
@@ -368,7 +368,7 b' Changing branch on public changeset'
368 $ hg branch -r . def
368 $ hg branch -r . def
369 abort: cannot change branch of public changesets
369 abort: cannot change branch of public changesets
370 (see 'hg help phases' for details)
370 (see 'hg help phases' for details)
371 [255]
371 [10]
372
372
373 Merge commit with conflicts, with evolution and without
373 Merge commit with conflicts, with evolution and without
374
374
@@ -12,7 +12,7 b' Refuse to amend public csets:'
12 $ hg ci --amend
12 $ hg ci --amend
13 abort: cannot amend public changesets
13 abort: cannot amend public changesets
14 (see 'hg help phases' for details)
14 (see 'hg help phases' for details)
15 [255]
15 [10]
16 $ hg phase -r . -f -d
16 $ hg phase -r . -f -d
17
17
18 $ echo a >> a
18 $ echo a >> a
@@ -407,7 +407,7 b' Refuse to amend during a merge:'
407 (branch merge, don't forget to commit)
407 (branch merge, don't forget to commit)
408 $ hg ci --amend
408 $ hg ci --amend
409 abort: cannot amend while merging
409 abort: cannot amend while merging
410 [255]
410 [20]
411 $ hg ci -m 'merge'
411 $ hg ci -m 'merge'
412
412
413 Refuse to amend if there is a merge conflict (issue5805):
413 Refuse to amend if there is a merge conflict (issue5805):
@@ -266,11 +266,11 b' nothing happens, even to the working dir'
266 $ hg fix -r 0
266 $ hg fix -r 0
267 abort: cannot fix public changesets
267 abort: cannot fix public changesets
268 (see 'hg help phases' for details)
268 (see 'hg help phases' for details)
269 [255]
269 [10]
270 $ hg fix -r 0 --working-dir
270 $ hg fix -r 0 --working-dir
271 abort: cannot fix public changesets
271 abort: cannot fix public changesets
272 (see 'hg help phases' for details)
272 (see 'hg help phases' for details)
273 [255]
273 [10]
274 $ hg cat -r tip hello.whole
274 $ hg cat -r tip hello.whole
275 hello
275 hello
276 $ cat hello.whole
276 $ cat hello.whole
@@ -1174,7 +1174,7 b' an orphan. We must respect experimental.'
1174 $ hg commit -m "second"
1174 $ hg commit -m "second"
1175 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1175 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1176 abort: cannot fix changeset with children
1176 abort: cannot fix changeset with children
1177 [255]
1177 [10]
1178 $ hg fix -r '.^'
1178 $ hg fix -r '.^'
1179 1 new orphan changesets
1179 1 new orphan changesets
1180 $ hg cat -r 2 foo.whole
1180 $ hg cat -r 2 foo.whole
@@ -309,7 +309,7 b' Check that histedit respect immutability'
309 $ hg histedit -r '.~2'
309 $ hg histedit -r '.~2'
310 abort: cannot edit public changesets
310 abort: cannot edit public changesets
311 (see 'hg help phases' for details)
311 (see 'hg help phases' for details)
312 [255]
312 [10]
313
313
314
314
315 Prepare further testing
315 Prepare further testing
@@ -551,7 +551,7 b' Test collapsing a middle revision in-pla'
551 $ hg rebase --collapse -r 1 -d 0
551 $ hg rebase --collapse -r 1 -d 0
552 abort: cannot rebase changeset with children
552 abort: cannot rebase changeset with children
553 (use --keep to keep original changesets)
553 (use --keep to keep original changesets)
554 [255]
554 [10]
555
555
556 Test collapsing in place
556 Test collapsing in place
557
557
@@ -327,15 +327,15 b' Check rebasing public changeset'
327 $ hg rebase -d 0 -b 6
327 $ hg rebase -d 0 -b 6
328 abort: cannot rebase public changesets
328 abort: cannot rebase public changesets
329 (see 'hg help phases' for details)
329 (see 'hg help phases' for details)
330 [255]
330 [10]
331 $ hg rebase -d 5 -b 6
331 $ hg rebase -d 5 -b 6
332 abort: cannot rebase public changesets
332 abort: cannot rebase public changesets
333 (see 'hg help phases' for details)
333 (see 'hg help phases' for details)
334 [255]
334 [10]
335 $ hg rebase -d 5 -r '1 + (6::)'
335 $ hg rebase -d 5 -r '1 + (6::)'
336 abort: cannot rebase public changesets
336 abort: cannot rebase public changesets
337 (see 'hg help phases' for details)
337 (see 'hg help phases' for details)
338 [255]
338 [10]
339
339
340 $ hg rebase -d 5 -b 6 --keep
340 $ hg rebase -d 5 -b 6 --keep
341 rebasing 6:e1c4361dd923 "C"
341 rebasing 6:e1c4361dd923 "C"
@@ -455,7 +455,7 b' Source on have two descendant heads but '
455 $ hg rebase -r '2::8' -d 1
455 $ hg rebase -r '2::8' -d 1
456 abort: cannot rebase changeset with children
456 abort: cannot rebase changeset with children
457 (use --keep to keep original changesets)
457 (use --keep to keep original changesets)
458 [255]
458 [10]
459 $ hg rebase -r '2::8' -d 1 -k
459 $ hg rebase -r '2::8' -d 1 -k
460 rebasing 2:c9e50f6cdc55 "C"
460 rebasing 2:c9e50f6cdc55 "C"
461 rebasing 3:ffd453c31098 "D"
461 rebasing 3:ffd453c31098 "D"
@@ -501,7 +501,7 b' Base on have one descendant heads we ask'
501 $ hg rebase -r '3::8' -d 1
501 $ hg rebase -r '3::8' -d 1
502 abort: cannot rebase changeset with children
502 abort: cannot rebase changeset with children
503 (use --keep to keep original changesets)
503 (use --keep to keep original changesets)
504 [255]
504 [10]
505 $ hg rebase -r '3::8' -d 1 --keep
505 $ hg rebase -r '3::8' -d 1 --keep
506 rebasing 3:ffd453c31098 "D"
506 rebasing 3:ffd453c31098 "D"
507 rebasing 6:3d8a618087a7 "G"
507 rebasing 6:3d8a618087a7 "G"
@@ -544,7 +544,7 b' rebase subset'
544 $ hg rebase -r '3::7' -d 1
544 $ hg rebase -r '3::7' -d 1
545 abort: cannot rebase changeset with children
545 abort: cannot rebase changeset with children
546 (use --keep to keep original changesets)
546 (use --keep to keep original changesets)
547 [255]
547 [10]
548 $ hg rebase -r '3::7' -d 1 --keep
548 $ hg rebase -r '3::7' -d 1 --keep
549 rebasing 3:ffd453c31098 "D"
549 rebasing 3:ffd453c31098 "D"
550 rebasing 6:3d8a618087a7 "G"
550 rebasing 6:3d8a618087a7 "G"
@@ -584,7 +584,7 b' rebase subset with multiple head'
584 $ hg rebase -r '3::(7+5)' -d 1
584 $ hg rebase -r '3::(7+5)' -d 1
585 abort: cannot rebase changeset with children
585 abort: cannot rebase changeset with children
586 (use --keep to keep original changesets)
586 (use --keep to keep original changesets)
587 [255]
587 [10]
588 $ hg rebase -r '3::(7+5)' -d 1 --keep
588 $ hg rebase -r '3::(7+5)' -d 1 --keep
589 rebasing 3:ffd453c31098 "D"
589 rebasing 3:ffd453c31098 "D"
590 rebasing 4:c01897464e7f "E"
590 rebasing 4:c01897464e7f "E"
@@ -79,7 +79,7 b' Cannot split a public changeset'
79 $ hg split .
79 $ hg split .
80 abort: cannot split public changesets
80 abort: cannot split public changesets
81 (see 'hg help phases' for details)
81 (see 'hg help phases' for details)
82 [255]
82 [10]
83
83
84 $ hg phase --draft -f -r 'all()'
84 $ hg phase --draft -f -r 'all()'
85
85
@@ -467,7 +467,7 b' Split a non-head without rebase'
467 #if obsstore-off
467 #if obsstore-off
468 $ runsplit -r 1 --no-rebase
468 $ runsplit -r 1 --no-rebase
469 abort: cannot split changeset with children
469 abort: cannot split changeset with children
470 [255]
470 [10]
471 #else
471 #else
472 $ runsplit -r 1 --no-rebase >/dev/null
472 $ runsplit -r 1 --no-rebase >/dev/null
473 3 new orphan changesets
473 3 new orphan changesets
@@ -518,7 +518,7 b' Split a non-head with obsoleted descenda'
518 $ rm .hg/localtags
518 $ rm .hg/localtags
519 $ hg split $B --config experimental.evolution=createmarkers
519 $ hg split $B --config experimental.evolution=createmarkers
520 abort: cannot split changeset with children
520 abort: cannot split changeset with children
521 [255]
521 [10]
522 $ cat > $TESTTMP/messages <<EOF
522 $ cat > $TESTTMP/messages <<EOF
523 > Split B
523 > Split B
524 > EOF
524 > EOF
@@ -284,7 +284,7 b' Unamending in middle of a stack'
284
284
285 $ hg --config experimental.evolution=createmarkers unamend
285 $ hg --config experimental.evolution=createmarkers unamend
286 abort: cannot unamend changeset with children
286 abort: cannot unamend changeset with children
287 [255]
287 [10]
288
288
289 $ hg unamend
289 $ hg unamend
290 3 new orphan changesets
290 3 new orphan changesets
@@ -298,7 +298,7 b' Trying to unamend a public changeset'
298 $ hg unamend
298 $ hg unamend
299 abort: cannot unamend public changesets
299 abort: cannot unamend public changesets
300 (see 'hg help phases' for details)
300 (see 'hg help phases' for details)
301 [255]
301 [10]
302
302
303 Testing whether unamend retains copies or not
303 Testing whether unamend retains copies or not
304
304
@@ -53,7 +53,7 b' Uncommit with no commits should fail'
53 $ hg uncommit
53 $ hg uncommit
54 abort: cannot uncommit null changeset
54 abort: cannot uncommit null changeset
55 (no changeset checked out)
55 (no changeset checked out)
56 [255]
56 [10]
57
57
58 Create some commits
58 Create some commits
59
59
@@ -411,7 +411,7 b' Add and expect uncommit to fail on both '
411
411
412 $ hg uncommit --config experimental.uncommitondirtywdir=True
412 $ hg uncommit --config experimental.uncommitondirtywdir=True
413 abort: cannot uncommit while merging
413 abort: cannot uncommit while merging
414 [255]
414 [20]
415
415
416 $ hg status
416 $ hg status
417 M a
417 M a
General Comments 0
You need to be logged in to leave comments. Login now