[PATCH 2 of 2] filemerge: more backwards compatible behavior for ui.merge

Steve Borho steve at borho.org
Wed Feb 6 21:33:34 CST 2008


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1202352265 21600
# Node ID 30418aa436caf4f6553f9988e1dcd841ee43ac2b
# Parent  160c9ee81ad826cc0af8af7d9aeaa0f91e4d12d8
filemerge: more backwards compatible behavior for ui.merge

if ui.merge matches a tool in [merge-tools], it is used as the
default tool selection but may be rejected by binary or gui or
other checks.  If ui.merge does not match a merge tool, it is
used unconditionally.

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -60,10 +60,14 @@
         t = k.split('.')[0]
         if t not in tools:
             tools[t] = int(_toolstr(ui, t, "priority", "0"))
+    names = tools.keys()
     tools = [(-p,t) for t,p in tools.items()]
     tools.sort()
-    if ui.config("ui", "merge"):
-        tools.insert(0, (None, ui.config("ui", "merge"))) # highest priority
+    uimerge = ui.config("ui", "merge")
+    if uimerge:
+        if uimerge not in names:
+            return (uimerge, uimerge)
+        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)


More information about the Mercurial-devel mailing list