diff mercurial/filemerge.py @ 39161:6618634e3325

filemerge: show warning if chosen tool has no binary files capability While matching patterns in "merge-patterns" configuration, Mercurial silently assumes that all merge tools have binary files capability. This implementation comes from 5af5f0f9d724 (or Mercurial 1.0). At failure of merging binary files with incorrect internal merge tool, there is no hint about this silent ignorance of binary files capability. This patch shows warning message, if chosen internal merge tool has no binary files capability. This will help users to investigate why a binary file isn't merged as expected.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 15 Aug 2018 22:24:38 +0900
parents 4d7b11877dd0
children cded904f7acc
line wrap: on
line diff
--- a/mercurial/filemerge.py	Tue Aug 14 20:15:51 2018 +0900
+++ b/mercurial/filemerge.py	Wed Aug 15 22:24:38 2018 +0900
@@ -195,6 +195,12 @@
     for pat, tool in ui.configitems("merge-patterns"):
         mf = match.match(repo.root, '', [pat])
         if mf(path) and check(tool, pat, symlink, False, changedelete):
+            if binary and not hascapability(tool, "binary", strict=True):
+                ui.warn(_("warning: check merge-patterns configurations,"
+                          " if %r for binary file %r is unintentional\n"
+                          "(see 'hg help merge-tools'"
+                          " for binary files capability)\n")
+                        % (pycompat.bytestr(tool), pycompat.bytestr(path)))
             toolpath = _findtool(ui, tool)
             return (tool, _quotetoolpath(toolpath))