mergetool: warn if ui.merge points to nonexistent tool
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 23 Jul 2018 22:51:53 -0700
changeset 38952 0e58c5b20745
parent 38951 6bfd1054d867
child 38953 987d3a4b989f
mergetool: warn if ui.merge points to nonexistent tool This adds a warning when ui.merge is configured but points to an executable that doesn't exist. It gets printed once per fail, but that seems to be how our other warnings about merge tools are reported. Differential Revision: https://phab.mercurial-scm.org/D3975
mercurial/filemerge.py
tests/test-merge-tools.t
--- a/mercurial/filemerge.py	Mon Jul 23 22:51:50 2018 -0700
+++ b/mercurial/filemerge.py	Mon Jul 23 22:51:53 2018 -0700
@@ -208,9 +208,10 @@
     if uimerge:
         # external tools defined in uimerge won't be able to handle
         # change/delete conflicts
-        if uimerge not in names and not changedelete:
-            return (uimerge, uimerge)
-        tools.insert(0, (None, uimerge)) # highest priority
+        if check(uimerge, path, symlink, binary, changedelete):
+            if uimerge not in names and not changedelete:
+                return (uimerge, uimerge)
+            tools.insert(0, (None, uimerge)) # highest priority
     tools.append((None, "hgmerge")) # the old default, if found
     for p, t in tools:
         if check(t, None, symlink, binary, changedelete):
--- a/tests/test-merge-tools.t	Mon Jul 23 22:51:50 2018 -0700
+++ b/tests/test-merge-tools.t	Mon Jul 23 22:51:53 2018 -0700
@@ -1748,7 +1748,9 @@
   missingbinary.executable=doesnotexist
   # hg update -C 1
   $ hg merge -y -r 2 --config ui.merge=missingbinary
+  couldn't find merge tool missingbinary (for pattern f)
   merging f
+  couldn't find merge tool missingbinary (for pattern f)
   revision 1
   space
   revision 0