changeset 5006:93014d9726d5

evolve: use ui.configoverride() instead of ui.backupconfig() ui.configoverride() was added in hg 4.1.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 09 Dec 2019 10:33:48 -0800
parents e66ba12e5db3
children de0151ba3e46
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Mon Dec 09 10:43:04 2019 -0800
+++ b/hgext3rd/evolve/evolvecmd.py	Mon Dec 09 10:33:48 2019 -0800
@@ -1022,16 +1022,14 @@
         del extra[b'branch']
     extra[b'rebase_source'] = orig.hex()
 
-    backup = repo.ui.backupconfig(b'phases', b'new-commit')
-    try:
-        targetphase = max(orig.phase(), phases.draft)
-        repo.ui.setconfig(b'phases', b'new-commit', targetphase, b'evolve')
+    targetphase = max(orig.phase(), phases.draft)
+    configoverride = repo.ui.configoverride({
+        (b'phases', b'new-commit'): targetphase
+    }, source=b'evolve')
+    with configoverride:
         # Commit might fail if unresolved files exist
-        nodenew = repo.commit(text=commitmsg, user=orig.user(),
-                              date=orig.date(), extra=extra)
-    finally:
-        repo.ui.restoreconfig(backup)
-    return nodenew
+        return repo.commit(text=commitmsg, user=orig.user(),
+                           date=orig.date(), extra=extra)
 
 def _finalizerelocate(repo, orig, dest, nodenew, tr, category, evolvestate):
     destbookmarks = repo.nodebookmarks(dest.node())