Mercurial > public > mercurial-scm > hg
comparison mercurial/filemerge.py @ 49167: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 | 5744ceeb9067 59466b13a3ae |
comparison
equal
deleted
inserted
replaced
49164:a932cad26d37 | 49167:7af798e497f5 |
---|---|
1117 | 1117 |
1118 | 1118 |
1119 def _run_partial_resolution_tools(repo, local, other, base): | 1119 def _run_partial_resolution_tools(repo, local, other, base): |
1120 """Runs partial-resolution tools on the three inputs and updates them.""" | 1120 """Runs partial-resolution tools on the three inputs and updates them.""" |
1121 ui = repo.ui | 1121 ui = repo.ui |
1122 if ui.configbool(b'merge', b'disable-partial-tools'): | |
1123 return | |
1122 # Tuples of (order, name, executable path, args) | 1124 # Tuples of (order, name, executable path, args) |
1123 tools = [] | 1125 tools = [] |
1124 seen = set() | 1126 seen = set() |
1125 section = b"partial-merge-tools" | 1127 section = b"partial-merge-tools" |
1126 for k, v in ui.configitems(section): | 1128 for k, v in ui.configitems(section): |
1131 is_match = True | 1133 is_match = True |
1132 if patterns: | 1134 if patterns: |
1133 m = match.match(repo.root, b'', patterns) | 1135 m = match.match(repo.root, b'', patterns) |
1134 is_match = m(local.fctx.path()) | 1136 is_match = m(local.fctx.path()) |
1135 if is_match: | 1137 if is_match: |
1138 if ui.configbool(section, b'%s.disable' % name): | |
1139 continue | |
1136 order = ui.configint(section, b'%s.order' % name, 0) | 1140 order = ui.configint(section, b'%s.order' % name, 0) |
1137 executable = ui.config(section, b'%s.executable' % name, name) | 1141 executable = ui.config(section, b'%s.executable' % name, name) |
1138 args = ui.config(section, b'%s.args' % name) | 1142 args = ui.config(section, b'%s.args' % name) |
1139 tools.append((order, name, executable, args)) | 1143 tools.append((order, name, executable, args)) |
1140 | 1144 |