topic: use ui.configoverride() instead of ui.backupconfig()
ui.configoverride() was added in hg 4.1. util.nullcontextmanager() was
added in hg 4.4.
--- a/hgext3rd/topic/__init__.py Mon Dec 09 10:28:58 2019 -0800
+++ b/hgext3rd/topic/__init__.py Mon Dec 09 10:31:34 2019 -0800
@@ -1261,14 +1261,13 @@
def checkt0(orig, ui, repo, node=None, rev=None, *args, **kwargs):
thezeros = set([b't0', b'b0', b's0'])
- backup = repo.ui.backupconfig(b'_internal', b'keep-topic')
- try:
- if node in thezeros or rev in thezeros:
- repo.ui.setconfig(b'_internal', b'keep-topic', b'yes',
- source=b'topic-extension')
+ configoverride = util.nullcontextmanager()
+ if node in thezeros or rev in thezeros:
+ configoverride = repo.ui.configoverride({
+ (b'_internal', b'keep-topic'): b'yes'
+ }, source=b'topic-extension')
+ with configoverride:
return orig(ui, repo, node=node, rev=rev, *args, **kwargs)
- finally:
- repo.ui.restoreconfig(backup)
def _fixrebase(loaded):
if not loaded: