# HG changeset patch # User Ruslan Sayfutdinov # Date 1453306618 28800 # Node ID ae4e6b80f0842cb5c9e8a4f6d5410f83fc3b861e # Parent 645e78845383591af0efc437c195fabee234f2a3 backout: fix --no-commit option (issue5054) diff -r 645e78845383 -r ae4e6b80f084 mercurial/commands.py --- a/mercurial/commands.py Tue Jan 19 13:43:50 2016 -0800 +++ b/mercurial/commands.py Wed Jan 20 08:16:58 2016 -0800 @@ -653,11 +653,6 @@ repo.ui.status(_("use 'hg resolve' to retry unresolved " "file merges\n")) return 1 - elif opts.get('no_commit'): - msg = _("changeset %s backed out, " - "don't forget to commit.\n") - ui.status(msg % short(node)) - return 0 finally: ui.setconfig('ui', 'forcemerge', '', '') lockmod.release(dsguard) @@ -666,6 +661,11 @@ repo.dirstate.setbranch(branch) cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) + if opts.get('no_commit'): + msg = _("changeset %s backed out, " + "don't forget to commit.\n") + ui.status(msg % short(node)) + return 0 def commitfunc(ui, repo, message, match, opts): editform = 'backout' diff -r 645e78845383 -r ae4e6b80f084 tests/test-backout.t --- a/tests/test-backout.t Tue Jan 19 13:43:50 2016 -0800 +++ b/tests/test-backout.t Wed Jan 20 08:16:58 2016 -0800 @@ -739,4 +739,17 @@ nine TEN +--no-commit shouldn't commit + $ hg init a + $ cd a + $ for i in 1 2 3; do + > touch $i + > hg ci -Am $i + > done + adding 1 + adding 2 + adding 3 + $ hg backout --no-commit . + removing 3 + changeset cccc23d9d68f backed out, don't forget to commit.