hgext3rd/topic/__init__.py
changeset 5007 de0151ba3e46
parent 4942 acc7e27fa5c6
child 5008 848ca807f83a
--- a/hgext3rd/topic/__init__.py	Mon Dec 09 10:33:48 2019 -0800
+++ b/hgext3rd/topic/__init__.py	Mon Dec 09 10:28:58 2019 -0800
@@ -385,14 +385,14 @@
             return caps
 
         def commit(self, *args, **kwargs):
-            backup = self.ui.backupconfig(b'ui', b'allowemptycommit')
-            try:
-                if self.currenttopic != self[b'.'].topic():
-                    # bypass the core "nothing changed" logic
-                    self.ui.setconfig(b'ui', b'allowemptycommit', True)
+            configoverride = util.nullcontextmanager()
+            if self.currenttopic != self[b'.'].topic():
+                # bypass the core "nothing changed" logic
+                configoverride = self.ui.configoverride({
+                    (b'ui', b'allowemptycommit'): True
+                })
+            with configoverride:
                 return super(topicrepo, self).commit(*args, **kwargs)
-            finally:
-                self.ui.restoreconfig(backup)
 
         def commitctx(self, ctx, *args, **kwargs):
             topicfilter = topicmap.topicfilter(self.filtername)