diff mercurial/filemerge.py @ 49202:7af798e497f5

filemerge: add configs to disable some or all partial merge tools When rolling out partial merge tools to users, it's useful to be able to easily turn one or all of them off if a problem is discovered. This patch adds support for that. They can of course also be useful for individual users to be able to temporarily turn off a tool they are otherwise using. Differential Revision: https://phab.mercurial-scm.org/D12588
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 26 Apr 2022 09:06:30 -0700
parents db93041e5b1c
children 59466b13a3ae 5744ceeb9067
line wrap: on
line diff
--- a/mercurial/filemerge.py	Wed May 04 18:17:44 2022 +0200
+++ b/mercurial/filemerge.py	Tue Apr 26 09:06:30 2022 -0700
@@ -1119,6 +1119,8 @@
 def _run_partial_resolution_tools(repo, local, other, base):
     """Runs partial-resolution tools on the three inputs and updates them."""
     ui = repo.ui
+    if ui.configbool(b'merge', b'disable-partial-tools'):
+        return
     # Tuples of (order, name, executable path, args)
     tools = []
     seen = set()
@@ -1133,6 +1135,8 @@
             m = match.match(repo.root, b'', patterns)
             is_match = m(local.fctx.path())
         if is_match:
+            if ui.configbool(section, b'%s.disable' % name):
+                continue
             order = ui.configint(section, b'%s.order' % name, 0)
             executable = ui.config(section, b'%s.executable' % name, name)
             args = ui.config(section, b'%s.args' % name)