This instance will be upgraded to Heptapod 0.26.0rc1 on 2021-10-26 at 14:30 UTC+2 (a few minutes of down time)

Commit 7a988622 authored by Valentin Gatien-Baron's avatar Valentin Gatien-Baron
Browse files

graft: exit 1 on conflicts, like merge

It's more consistent, and makes it nicer to script around hg if you
don't have to ignore exit code 255, which is the error code for
basically everything in hg.

Differential Revision: https://phab.mercurial-scm.org/D8423
parent 5c2a4f37eace
......@@ -2951,7 +2951,7 @@ def graft(ui, repo, *revs, **opts):
See :hg:`help revisions` for more about specifying revisions.
Returns 0 on successful completion.
Returns 0 on successful completion, 1 if there are unresolved files.
'''
with repo.wlock():
return _dograft(ui, repo, *revs, **opts)
......@@ -3212,10 +3212,9 @@ def _dograft(ui, repo, *revs, **opts):
statedata[b'nodes'] = nodes
stateversion = 1
graftstate.save(stateversion, statedata)
hint = _(b"use 'hg resolve' and 'hg graft --continue'")
raise error.Abort(
_(b"unresolved conflicts, can't continue"), hint=hint
)
ui.error(_(b"abort: unresolved conflicts, can't continue\n"))
ui.error(_(b"(use 'hg resolve' and 'hg graft --continue')\n"))
return 1
else:
cont = False
......
......@@ -564,7 +564,7 @@ test the same case, this time with updating
warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg bisect --reset
$ hg up -C .
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
......
......@@ -109,7 +109,7 @@ BROKEN: This should succeed and merge the changes from x into y
What do you want to do? u
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Add x, remove it, then add it back, then rename x to y. Similar to the case
above, but here the break in history is before the rename.
......@@ -193,7 +193,7 @@ BROKEN: This should succeed and merge the changes from x into y
What do you want to do? u
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
#endif
$ hg co -qC 2
BROKEN: This should succeed and merge the changes from x into y
......@@ -204,7 +204,7 @@ BROKEN: This should succeed and merge the changes from x into y
What do you want to do? u
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Add x, remove it, then add it back, rename x to y from the first commit.
Similar to the case above, but here the break in history is parallel to the
......@@ -278,7 +278,7 @@ BROKEN: This should succeed and merge the changes from x into y
What do you want to do? u
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Add x on two branches, then rename x to y on one side. Similar to the case
above, but here the break in history is via the base commit.
......@@ -361,7 +361,7 @@ BROKEN: This should succeed and merge the changes from x into y
What do you want to do? u
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
#endif
$ hg co -qC 2
BROKEN: This should succeed and merge the changes from x into y
......@@ -372,7 +372,7 @@ BROKEN: This should succeed and merge the changes from x into y
What do you want to do? u
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Copies via null revision (there shouldn't be any)
$ newrepo
......
......@@ -32,7 +32,7 @@ Testing the reading of old format graftstate file with newer mercurial
warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Writing the nodes in old format to graftstate
......@@ -91,7 +91,7 @@ running `hg graft --continue`
warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ echo wat > b
$ hg resolve -m
......@@ -141,7 +141,7 @@ Test that --date is preserved and reused in `hg graft --continue`
warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ echo foobar > b
$ hg resolve -m
......@@ -180,7 +180,7 @@ Test that --log is preserved and reused in `hg graft --continue`
warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ echo foobar > b
$ hg resolve -m
......@@ -246,7 +246,7 @@ Testing the --stop flag of `hg graft` which stops the interrupted graft
warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg graft --stop --continue
abort: cannot use '--continue' and '--stop' together
......@@ -283,7 +283,7 @@ Testing the --stop flag of `hg graft` which stops the interrupted graft
warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg graft --stop
stopped the interrupted graft
......@@ -352,7 +352,7 @@ when stripping is required
warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg graft --continue --abort
abort: cannot use '--continue' and '--abort' together
......@@ -399,7 +399,7 @@ when stripping is not required
warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg abort
graft aborted
......@@ -426,7 +426,7 @@ when some of the changesets became public
warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg log -GT "{rev}:{node|short} {desc}"
@ 6:6ec71c037d94 added x
......@@ -488,7 +488,7 @@ when we created new changesets on top of existing one
warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ cd ..
$ hg init pullrepo
......@@ -609,7 +609,7 @@ Prepare wrdir to check --no-commit is resepected after --continue:
warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Resolve conflict:
$ echo A>a
......@@ -648,7 +648,7 @@ Check --no-commit is resepected when passed with --continue:
warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Resolve conflict:
$ echo A>a
......@@ -688,7 +688,7 @@ When there is conflict:
warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ echo A>a
$ hg resolve --mark
......
......@@ -260,7 +260,7 @@ Graft out of order, skipping a merge and a duplicate
warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Summary should mention graft:
......@@ -317,7 +317,7 @@ Graft again:
warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
Continue without resolve should fail:
......@@ -511,7 +511,7 @@ Resolve conflicted graft
grafting 1:5d205f8b35b6 "1"
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg resolve --all
merging a
warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
......@@ -551,7 +551,7 @@ Resolve conflicted graft with rename
grafting 2:5c095ad7e90f "2"
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg resolve --all
merging a and b to b
(no more unresolved files)
......@@ -839,7 +839,7 @@ graft --continue after --force
grafting 24:2e7ea477be26 "24"
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ hg resolve --all
merging a
warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
......
......@@ -74,7 +74,7 @@ https://bz.mercurial-scm.org/show_bug.cgi?id=4476
warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
(use 'hg resolve' and 'hg graft --continue')
[255]
[1]
$ echo a > b
$ echo b3 >> b
$ hg resolve --mark b
......
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