Mercurial > public > mercurial-scm > hg
diff mercurial/cmdutil.py @ 20700:b0153cb8b64e stable
commit: create new amend changeset as secret correctly for "--secret" option
Before this patch, "hg commit --amend --secret" doesn't create new
amend changeset as secret, even though the internal function
"commitfunc()" passed to "cmdutil.amend()" make "phases.new-commit"
configuration as "secret" temporarily.
"cmdutil.amend()" uses specified "commitfunc" only for temporary amend
commit, and creates the final amend commit changeset by
"localrepository.commitctx()" directly with memctx.
This patch creates new amend changeset as secret correctly for
"--secret" option, by changing "phases.new-commit" configuration
temporarily before "localrepository.commitctx()".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 13 Mar 2014 19:48:41 +0900 |
parents | 6d4fda48b4e3 |
children | 2764148aa088 434619dae569 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Wed Mar 12 10:26:48 2014 +0200 +++ b/mercurial/cmdutil.py Thu Mar 13 19:48:41 2014 +0900 @@ -1797,7 +1797,11 @@ ph = repo.ui.config('phases', 'new-commit', phases.draft) try: - repo.ui.setconfig('phases', 'new-commit', old.phase()) + if opts.get('secret'): + commitphase = 'secret' + else: + commitphase = old.phase() + repo.ui.setconfig('phases', 'new-commit', commitphase) newid = repo.commitctx(new) finally: repo.ui.setconfig('phases', 'new-commit', ph)