diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1592,7 +1592,9 @@ node = cmdutil.amend(ui, repo, old, extra, pats, opts) if node == old.node(): ui.status(_("nothing changed\n")) - return 1 + # Returning 0 because this is not technically an error condition, + # and it makes some scripts a little easier to write. + return 0 else: def commitfunc(ui, repo, message, match, opts): overrides = {} @@ -1622,6 +1624,9 @@ "'hg status')\n") % len(stat[3])) else: ui.status(_("nothing changed\n")) + # "amend" not doing something in a script might be expected; + # "commit" not doing something in a script is generally a bug + # somewhere, so we return non-zero here. return 1 cmdutil.commitstatus(repo, node, branch, bheads, opts) diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -83,15 +83,12 @@ $ hg amend nothing changed - [1] $ hg amend -d "0 0" nothing changed - [1] $ hg amend -d "Thu Jan 01 00:00:00 1970 UTC" nothing changed - [1] Matcher and metadata options diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -22,7 +22,6 @@ $ hg ci --amend -m 'base1' nothing changed - [1] $ cat >> $HGRCPATH < [hooks]