Mercurial > evolve
changeset 5009:0ab3b94562ab
evolve: 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:36:11 -0800 |
parents | 848ca807f83a |
children | effce0a1f5bd |
files | hgext3rd/evolve/__init__.py |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Mon Dec 09 10:31:34 2019 -0800 +++ b/hgext3rd/evolve/__init__.py Mon Dec 09 10:36:11 2019 -0800 @@ -1026,15 +1026,14 @@ target, bookmark = _findprevtarget(repo, displayer, opts.get('move_bookmark'), topic) if target is not None: - backup = repo.ui.backupconfig(b'_internal', b'keep-topic') - try: - if topic and _getcurrenttopic(repo) != _gettopic(target): - repo.ui.setconfig(b'_internal', b'keep-topic', b'yes', - source=b'topic-extension') + configoverride = util.nullcontextmanager() + if topic and _getcurrenttopic(repo) != _gettopic(target): + configoverride = repo.ui.configoverride({ + (b'_internal', b'keep-topic'): b'yes' + }, source=b'topic-extension') + with configoverride: _prevupdate(repo, displayer, target, bookmark, dryrunopt, mergeopt) - finally: - repo.ui.restoreconfig(backup) return 0 else: return 1