Mercurial > hg-stable
changeset 22039:0aa2cb965f4c
commit: update the --secret code to use backupconfig and restoreconfig
Those dedicated methods also preserve all associated data (eg:
sources, lack of value).
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 05 Aug 2014 18:53:05 -0700 |
parents | 021becbf024a |
children | 122fa73657c6 |
files | mercurial/commands.py |
diffstat | 1 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Aug 05 13:22:44 2014 -0700 +++ b/mercurial/commands.py Tue Aug 05 18:53:05 2014 -0700 @@ -1386,9 +1386,6 @@ # Let --subrepos on the command line override config setting. ui.setconfig('ui', 'commitsubrepos', True, 'commit') - # Save this for restoring it later - oldcommitphase = ui.config('phases', 'new-commit') - cmdutil.checkunfinished(repo, commit=True) branch = repo[None].branch() @@ -1442,12 +1439,14 @@ newmarks.write() else: def commitfunc(ui, repo, message, match, opts): + backup = ui.backupconfig('phases', 'new-commit') + baseui = repo.baseui + basebackup = baseui.backupconfig('phases', 'new-commit') try: if opts.get('secret'): ui.setconfig('phases', 'new-commit', 'secret', 'commit') # Propagate to subrepos - repo.baseui.setconfig('phases', 'new-commit', 'secret', - 'commit') + baseui.setconfig('phases', 'new-commit', 'secret', 'commit') editform = 'commit.normal' editor = cmdutil.getcommiteditor(editform=editform, **opts) @@ -1456,9 +1455,8 @@ editor=editor, extra=extra) finally: - ui.setconfig('phases', 'new-commit', oldcommitphase, 'commit') - repo.baseui.setconfig('phases', 'new-commit', oldcommitphase, - 'commit') + ui.restoreconfig(backup) + repo.baseui.restoreconfig(basebackup) node = cmdutil.commit(ui, repo, commitfunc, pats, opts)