evolve: 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/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