hgext/rebase.py
changeset 31461 f255b1811f5e
parent 31431 406705701c2d
child 31514 2519994d25ca
--- a/hgext/rebase.py	Thu Mar 16 14:39:18 2017 -0700
+++ b/hgext/rebase.py	Thu Mar 16 14:40:34 2017 -0700
@@ -851,10 +851,9 @@
         if extrafn:
             extrafn(ctx, extra)
 
-        backup = repo.ui.backupconfig('phases', 'new-commit')
-        try:
-            targetphase = max(ctx.phase(), phases.draft)
-            repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase')
+        targetphase = max(ctx.phase(), phases.draft)
+        overrides = {('phases', 'new-commit'): targetphase}
+        with repo.ui.configoverride(overrides, 'rebase'):
             if keepbranch:
                 repo.ui.setconfig('ui', 'allowemptycommit', True)
             # Commit might fail if unresolved files exist
@@ -862,8 +861,6 @@
                 date = ctx.date()
             newnode = repo.commit(text=commitmsg, user=ctx.user(),
                                   date=date, extra=extra, editor=editor)
-        finally:
-            repo.ui.restoreconfig(backup)
 
         repo.dirstate.setbranch(repo[newnode].branch())
         dsguard.close()