merge: use context manager for config override
Differential Revision: https://phab.mercurial-scm.org/D3739
--- a/mercurial/commands.py Thu Jun 14 15:45:16 2018 -0700
+++ b/mercurial/commands.py Thu Jun 14 15:45:45 2018 -0700
@@ -3684,15 +3684,13 @@
displayer.close()
return 0
- try:
- # ui.forcemerge is an internal variable, do not document
- repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge')
+ # ui.forcemerge is an internal variable, do not document
+ overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
+ with ui.configoverride(overrides, 'merge'):
force = opts.get('force')
labels = ['working copy', 'merge rev']
return hg.merge(repo, node, force=force, mergeforce=force,
labels=labels, abort=abort)
- finally:
- ui.setconfig('ui', 'forcemerge', '', 'merge')
@command('outgoing|out',
[('f', 'force', None, _('run even when the destination is unrelated')),