rebase: get rid of ui.backupconfig
authorJun Wu <quark@fb.com>
Thu, 16 Mar 2017 14:40:34 -0700
changeset 31461 f255b1811f5e
parent 31460 03d99d08147b
child 31462 d1ce2124ec83
rebase: get rid of ui.backupconfig
hgext/rebase.py
--- 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()