D3738: graft: use context manager for config override
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Jun 14 23:34:12 UTC 2018
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3738
AFFECTED FILES
mercurial/commands.py
CHANGE DETAILS
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2358,14 +2358,9 @@
# we don't merge the first commit when continuing
if not cont:
# perform the graft merge with p1(rev) as 'ancestor'
- try:
- # ui.forcemerge is an internal variable, do not document
- repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
- 'graft')
- stats = mergemod.graft(repo, ctx, ctx.p1(),
- ['local', 'graft'])
- finally:
- repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
+ overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
+ with ui.configoverride(overrides, 'graft'):
+ stats = mergemod.graft(repo, ctx, ctx.p1(), ['local', 'graft'])
# report any conflicts
if stats.unresolvedcount > 0:
# write out state for --continue
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list