mercurial/commands.py
changeset 38315 79dcaad9d145
parent 38282 1a05e205832a
child 38316 7e34fc78701a
--- a/mercurial/commands.py	Thu Jun 14 11:49:10 2018 -0400
+++ b/mercurial/commands.py	Thu Jun 14 15:45:16 2018 -0700
@@ -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