# HG changeset patch # User Martin von Zweigbergk # Date 1575916294 28800 # Node ID 848ca807f83a6c0c9a33be725a80c5e3b87e4fc2 # Parent de0151ba3e463e8e2e5f3627dd55b7ae34351587 topic: use ui.configoverride() instead of ui.backupconfig() ui.configoverride() was added in hg 4.1. util.nullcontextmanager() was added in hg 4.4. diff -r de0151ba3e46 -r 848ca807f83a hgext3rd/topic/__init__.py --- 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: