pick: reduce configoverride() scope
authorAnton Shestakov <av6@dwimlabs.net>
Sat, 08 Jun 2019 16:57:34 +0800
changeset 4679 d9016946ec69
parent 4678 36c2bac8cab3
child 4680 52c1809f35c1
pick: reduce configoverride() scope Merge tool is only needed for merge.graft() (it's what graft in core hg does), so let's make the scope of the ui.configoverride() narrower.
hgext3rd/evolve/cmdrewrite.py
--- a/hgext3rd/evolve/cmdrewrite.py	Sat Jun 08 16:09:37 2019 +0800
+++ b/hgext3rd/evolve/cmdrewrite.py	Sat Jun 08 16:57:34 2019 +0800
@@ -1430,8 +1430,7 @@
     if opts.get('rev'):
         revs.append(opts['rev'])
 
-    overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
-    with repo.wlock(), repo.lock(), repo.transaction('pick'), ui.configoverride(overrides, 'pick'):
+    with repo.wlock(), repo.lock(), repo.transaction('pick'):
         pickstate = state.cmdstate(repo, path='pickstate')
         pctx = repo['.']
 
@@ -1453,8 +1452,10 @@
             ui.status(_('picking %d:%s "%s"\n') %
                       (origctx.rev(), origctx,
                        origctx.description().split("\n", 1)[0]))
-            stats = merge.graft(repo, origctx, origctx.p1(), ['local',
-                                                              'destination'])
+            overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
+            with ui.configoverride(overrides, 'pick'):
+                stats = merge.graft(repo, origctx, origctx.p1(),
+                                    ['local', 'destination'])
             if compat.hasconflict(stats):
                 pickstate.addopts({'orignode': origctx.node(),
                                    'oldpctx': pctx.node()})