##// END OF EJS Templates
commit: update the --secret code to use backupconfig and restoreconfig...
Pierre-Yves David -
r22039:0aa2cb96 default
parent child Browse files
Show More
@@ -1386,9 +1386,6 b' def commit(ui, repo, *pats, **opts):'
1386 # Let --subrepos on the command line override config setting.
1386 # Let --subrepos on the command line override config setting.
1387 ui.setconfig('ui', 'commitsubrepos', True, 'commit')
1387 ui.setconfig('ui', 'commitsubrepos', True, 'commit')
1388
1388
1389 # Save this for restoring it later
1390 oldcommitphase = ui.config('phases', 'new-commit')
1391
1392 cmdutil.checkunfinished(repo, commit=True)
1389 cmdutil.checkunfinished(repo, commit=True)
1393
1390
1394 branch = repo[None].branch()
1391 branch = repo[None].branch()
@@ -1442,12 +1439,14 b' def commit(ui, repo, *pats, **opts):'
1442 newmarks.write()
1439 newmarks.write()
1443 else:
1440 else:
1444 def commitfunc(ui, repo, message, match, opts):
1441 def commitfunc(ui, repo, message, match, opts):
1442 backup = ui.backupconfig('phases', 'new-commit')
1443 baseui = repo.baseui
1444 basebackup = baseui.backupconfig('phases', 'new-commit')
1445 try:
1445 try:
1446 if opts.get('secret'):
1446 if opts.get('secret'):
1447 ui.setconfig('phases', 'new-commit', 'secret', 'commit')
1447 ui.setconfig('phases', 'new-commit', 'secret', 'commit')
1448 # Propagate to subrepos
1448 # Propagate to subrepos
1449 repo.baseui.setconfig('phases', 'new-commit', 'secret',
1449 baseui.setconfig('phases', 'new-commit', 'secret', 'commit')
1450 'commit')
1451
1450
1452 editform = 'commit.normal'
1451 editform = 'commit.normal'
1453 editor = cmdutil.getcommiteditor(editform=editform, **opts)
1452 editor = cmdutil.getcommiteditor(editform=editform, **opts)
@@ -1456,9 +1455,8 b' def commit(ui, repo, *pats, **opts):'
1456 editor=editor,
1455 editor=editor,
1457 extra=extra)
1456 extra=extra)
1458 finally:
1457 finally:
1459 ui.setconfig('phases', 'new-commit', oldcommitphase, 'commit')
1458 ui.restoreconfig(backup)
1460 repo.baseui.setconfig('phases', 'new-commit', oldcommitphase,
1459 repo.baseui.restoreconfig(basebackup)
1461 'commit')
1462
1460
1463
1461
1464 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
1462 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
General Comments 0
You need to be logged in to leave comments. Login now