@@ -1383,13 +1383,10 @@ def commit(ui, repo, *pats, **opts):
if opts.get('amend'):
raise util.Abort(_('cannot amend with --subrepos'))
# 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()
bheads = repo.branchheads(branch)
@@ -1439,25 +1436,26 @@ def commit(ui, repo, *pats, **opts):
if bm == current:
bookmarks.setcurrent(repo, bm)
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')
return repo.commit(message, opts.get('user'), opts.get('date'),
match,
editor=cmdutil.getcommiteditor(**opts),
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)
if not node: