changeset 31460:03d99d08147b

mq: get rid of ui.backupconfig
author Jun Wu <quark@fb.com>
date Thu, 16 Mar 2017 14:39:18 -0700
parents f84fbd27b6d3
children f255b1811f5e
files hgext/mq.py
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Thu Mar 16 14:36:35 2017 -0700
+++ b/hgext/mq.py	Thu Mar 16 14:39:18 2017 -0700
@@ -405,18 +405,12 @@
     if phase is None:
         if repo.ui.configbool('mq', 'secret', False):
             phase = phases.secret
+    overrides = {('ui', 'allowemptycommit'): True}
     if phase is not None:
-        phasebackup = repo.ui.backupconfig('phases', 'new-commit')
-    allowemptybackup = repo.ui.backupconfig('ui', 'allowemptycommit')
-    try:
-        if phase is not None:
-            repo.ui.setconfig('phases', 'new-commit', phase, 'mq')
+        overrides[('phases', 'new-commit')] = phase
+    with repo.ui.configoverride(overrides, 'mq'):
         repo.ui.setconfig('ui', 'allowemptycommit', True)
         return repo.commit(*args, **kwargs)
-    finally:
-        repo.ui.restoreconfig(allowemptybackup)
-        if phase is not None:
-            repo.ui.restoreconfig(phasebackup)
 
 class AbortNoCleanup(error.Abort):
     pass