Mercurial > hg
changeset 38317:ff9694ea3852
resolve: use context manager for config override
Differential Revision: https://phab.mercurial-scm.org/D3740
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 14 Jun 2018 15:46:17 -0700 |
parents | 7e34fc78701a |
children | 929405af558a |
files | mercurial/commands.py |
diffstat | 1 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jun 14 15:45:45 2018 -0700 +++ b/mercurial/commands.py Thu Jun 14 15:46:17 2018 -0700 @@ -4553,15 +4553,14 @@ try: # preresolve file - ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), - 'resolve') - complete, r = ms.preresolve(f, wctx) + overrides = {('ui', 'forcemerge'): opts.get('tool', '')} + with ui.configoverride(overrides, 'resolve'): + complete, r = ms.preresolve(f, wctx) if not complete: tocomplete.append(f) elif r: ret = 1 finally: - ui.setconfig('ui', 'forcemerge', '', 'resolve') ms.commit() # replace filemerge's .orig file with our resolve file, but only @@ -4577,13 +4576,12 @@ for f in tocomplete: try: # resolve file - ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), - 'resolve') - r = ms.resolve(f, wctx) + overrides = {('ui', 'forcemerge'): opts.get('tool', '')} + with ui.configoverride(overrides, 'resolve'): + r = ms.resolve(f, wctx) if r: ret = 1 finally: - ui.setconfig('ui', 'forcemerge', '', 'resolve') ms.commit() # replace filemerge's .orig file with our resolve file