diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3302,8 +3302,8 @@ # This not what we expect from amend. return old.node() - if opts.get('secret'): - commitphase = 'secret' + if opts.get('secret') is not None: + commitphase = 'secret' if opts.get('secret') else 'draft' else: commitphase = old.phase() overrides = {('phases', 'new-commit'): commitphase} 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 @@ -879,11 +879,24 @@ 29: draft 31: secret +Test that amend with --no-secret creates new draft changeset forcibly +(ignoring both the existing phase and phases.new-commit=secret) +--------------------------------------------------------------------- + + $ hg phase '.^::.' + 29: draft + 31: secret + $ hg --config phases.new-commit=secret \ + > commit --amend --no-secret -m 'amend as no-secret' -q + $ hg phase '.^::.' + 29: draft + 32: draft + Test that amend with --edit invokes editor forcibly --------------------------------------------------- $ hg parents --template "{desc}\n" - amend as secret + amend as no-secret $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" $ hg parents --template "{desc}\n" editor should be suppressed