135 return p |
135 return p |
136 exe = _toolstr(ui, tool, "executable", tool) |
136 exe = _toolstr(ui, tool, "executable", tool) |
137 return procutil.findexe(util.expandpath(exe)) |
137 return procutil.findexe(util.expandpath(exe)) |
138 |
138 |
139 def _picktool(repo, ui, path, binary, symlink, changedelete): |
139 def _picktool(repo, ui, path, binary, symlink, changedelete): |
|
140 strictcheck = ui.configbool('merge', 'strict-capability-check') |
|
141 |
140 def hascapability(tool, capability, strict=False): |
142 def hascapability(tool, capability, strict=False): |
141 if strict and tool in internals: |
143 if strict and tool in internals: |
142 if internals[tool].capabilities.get(capability): |
144 if internals[tool].capabilities.get(capability): |
143 return True |
145 return True |
144 return _toolbool(ui, tool, capability) |
146 return _toolbool(ui, tool, capability) |
153 if not _findtool(ui, tool): |
155 if not _findtool(ui, tool): |
154 if pat: # explicitly requested tool deserves a warning |
156 if pat: # explicitly requested tool deserves a warning |
155 ui.warn(_("couldn't find merge tool %s\n") % tmsg) |
157 ui.warn(_("couldn't find merge tool %s\n") % tmsg) |
156 else: # configured but non-existing tools are more silent |
158 else: # configured but non-existing tools are more silent |
157 ui.note(_("couldn't find merge tool %s\n") % tmsg) |
159 ui.note(_("couldn't find merge tool %s\n") % tmsg) |
158 elif symlink and not hascapability(tool, "symlink"): |
160 elif symlink and not hascapability(tool, "symlink", strictcheck): |
159 ui.warn(_("tool %s can't handle symlinks\n") % tmsg) |
161 ui.warn(_("tool %s can't handle symlinks\n") % tmsg) |
160 elif binary and not hascapability(tool, "binary"): |
162 elif binary and not hascapability(tool, "binary", strictcheck): |
161 ui.warn(_("tool %s can't handle binary\n") % tmsg) |
163 ui.warn(_("tool %s can't handle binary\n") % tmsg) |
162 elif changedelete and not supportscd(tool): |
164 elif changedelete and not supportscd(tool): |
163 # the nomerge tools are the only tools that support change/delete |
165 # the nomerge tools are the only tools that support change/delete |
164 # conflicts |
166 # conflicts |
165 pass |
167 pass |
190 return ":prompt", None |
192 return ":prompt", None |
191 else: |
193 else: |
192 return (hgmerge, hgmerge) |
194 return (hgmerge, hgmerge) |
193 |
195 |
194 # then patterns |
196 # then patterns |
|
197 |
|
198 # whether binary capability should be checked strictly |
|
199 binarycap = binary and strictcheck |
|
200 |
195 for pat, tool in ui.configitems("merge-patterns"): |
201 for pat, tool in ui.configitems("merge-patterns"): |
196 mf = match.match(repo.root, '', [pat]) |
202 mf = match.match(repo.root, '', [pat]) |
197 if mf(path) and check(tool, pat, symlink, False, changedelete): |
203 if mf(path) and check(tool, pat, symlink, binarycap, changedelete): |
198 if binary and not hascapability(tool, "binary", strict=True): |
204 if binary and not hascapability(tool, "binary", strict=True): |
199 ui.warn(_("warning: check merge-patterns configurations," |
205 ui.warn(_("warning: check merge-patterns configurations," |
200 " if %r for binary file %r is unintentional\n" |
206 " if %r for binary file %r is unintentional\n" |
201 "(see 'hg help merge-tools'" |
207 "(see 'hg help merge-tools'" |
202 " for binary files capability)\n") |
208 " for binary files capability)\n") |