[PATCH 4 of 4 V2] resolve: wrap implementation in a ui.tempconfig context
Siddharth Agarwal
sid0 at fb.com
Sun Mar 20 23:18:42 EDT 2016
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1458530037 25200
# Sun Mar 20 20:13:57 2016 -0700
# Node ID 421c17c403814ee627170de854d1628350439895
# Parent 9df7db49e7bc5f0e9a1630e048fdbe8191e04da0
resolve: wrap implementation in a ui.tempconfig context
This makes sure that the --tool config applies to the merge driver preprocess
and conclude steps, and also ensures that it applies to whatever other new
potential resolve calls we make in the future.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2944,15 +2944,12 @@ def resolve(ui, repo, ms, pats, opts):
try:
# preresolve file
- ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
- '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
@@ -2968,13 +2965,10 @@ def resolve(ui, repo, ms, pats, opts):
for f in tocomplete:
try:
# resolve file
- ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
- '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
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6025,7 +6025,8 @@ def resolve(ui, repo, *pats, **opts):
with repo.wlock():
ms = mergemod.mergestate.read(repo)
- ret, showhint = cmdutil.resolve(ui, repo, ms, pats, opts)
+ with ui.tempconfig('ui', 'forcemerge', opts.get('tool', ''), 'resolve'):
+ ret, showhint = cmdutil.resolve(ui, repo, ms, pats, opts)
if showhint is None:
pass
More information about the Mercurial-devel
mailing list