Commit f14ed4ab authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

backout: correct commit status of no changes made (BC) (issue4190)

If backout generated no changes to commit, it showed wrong status, "changeset
<target> backs out changeset <target>", and raised TypeError with -v option.

This changes the return code to 1, which is the same as "hg commit" and
"hg rebase".

branch : stable
parent e01cff65f4c5
......@@ -416,7 +416,8 @@ def backout(ui, repo, node=None, rev=None, **opts):
See :hg:`help dates` for a list of formats valid for -d/--date.
Returns 0 on success, 1 if there are unresolved files.
Returns 0 on success, 1 if nothing to backout or there are unresolved
if rev and node:
raise util.Abort(_("please specify just one revision"))
......@@ -495,6 +496,9 @@ def backout(ui, repo, node=None, rev=None, **opts):
return repo.commit(message, opts.get('user'), opts.get('date'),
match, editor=e)
newnode = cmdutil.commit(ui, repo, commitfunc, [], opts)
if not newnode:
ui.status(_("nothing changed\n"))
return 1
cmdutil.commitstatus(repo, newnode, branch, bheads)
def nice(node):
......@@ -409,6 +409,22 @@ on branch1, so no file1 and file2:
$ cd ..
backout of empty changeset (issue4190)
$ hg init emptycommit
$ cd emptycommit
$ touch file1
$ hg ci -Aqm file1
$ hg branch -q branch1
$ hg ci -qm branch1
$ hg backout -v 1
resolving manifests
nothing changed
$ cd ..
Test usage of `hg resolve` in case of conflict
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