[PATCH] More verbose logging when filemerge searches for merge-tool

Mads Kiilerich mads at kiilerich.com
Thu Nov 6 19:47:22 CST 2008


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1226022432 -3600
# Node ID ec0e706df394730dfc97dd1fd34bce2d4eedc8b7
# Parent  eae1767cc6a8002a1d75b3af40e11782efc288ba
More verbose logging when filemerge searches for merge-tool

Previously it was very hard to find out what was going on when the expected
merge tool wasn't used. This patch tries to improve that.

hg merge -v now shows which tools were searched for but not found.

diff -r eae1767cc6a8 -r ec0e706df394 mercurial/filemerge.py
--- a/mercurial/filemerge.py	Thu Nov 06 11:17:38 2008 +0100
+++ b/mercurial/filemerge.py	Fri Nov 07 02:47:12 2008 +0100
@@ -32,8 +32,11 @@
         tmsg = tool
         if pat:
             tmsg += " specified for " + pat
-        if pat and not _findtool(ui, tool): # skip search if not matching
-            ui.warn(_("couldn't find merge tool %s\n") % tmsg)
+        if not _findtool(ui, tool):
+            if pat: # explicitly requested tool deserves a warning
+                ui.warn(_("couldn't find merge tool %s\n") % tmsg)
+            else: # configured but non-existing tools are more silent
+                ui.note(_("couldn't find merge tool %s\n") % tmsg)
         elif symlink and not _toolbool(ui, tool, "symlink"):
             ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
         elif binary and not _toolbool(ui, tool, "binary"):
@@ -71,8 +74,8 @@
         tools.insert(0, (None, uimerge)) # highest priority
     tools.append((None, "hgmerge")) # the old default, if found
     for p,t in tools:
-        toolpath = _findtool(ui, t)
-        if toolpath and check(t, None, symlink, binary):
+        if check(t, None, symlink, binary):
+            toolpath = _findtool(ui, t)
             return (t, '"' + toolpath + '"')
     # internal merge as last resort
     return (not (symlink or binary) and "internal:merge" or None, None)


More information about the Mercurial-devel mailing list