changeset 31461:f255b1811f5e

rebase: get rid of ui.backupconfig
author Jun Wu <quark@fb.com>
date Thu, 16 Mar 2017 14:40:34 -0700
parents 03d99d08147b
children d1ce2124ec83
files hgext/rebase.py
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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()