Mercurial > evolve
changeset 5008:848ca807f83a
topic: use ui.configoverride() instead of ui.backupconfig()
ui.configoverride() was added in hg 4.1. util.nullcontextmanager() was
added in hg 4.4.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 09 Dec 2019 10:31:34 -0800 |
parents | de0151ba3e46 |
children | 0ab3b94562ab |
files | hgext3rd/topic/__init__.py |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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: