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

Steve Borho steve at borho.org
Mon Feb 4 21:47:32 CST 2008


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1202183245 21600
# Node ID ce3bcf0fd12054659f7798c46cea4554618ae1b5
# Parent  532093498c8f7953d01a1bc3d874deee24d8be24
filemerge: more backwards compatible behavior for ui.merge

ui.merge is parsed into (tool, args).  [merge-tools] is still referenced
to find tool.properties, but if args are specified in ui.merge they take
precedence over merge-tools.tool.args.

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -7,7 +7,7 @@
 
 from node import *
 from i18n import _
-import util, os, tempfile, context, simplemerge, re, filecmp
+import util, os, tempfile, context, simplemerge, re, filecmp, shlex
 
 def _toolstr(ui, tool, part, default=""):
     return ui.config("merge-tools", tool + "." + part, default)
@@ -63,7 +63,11 @@
     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
+        args = shlex.split(ui.config("ui", "merge"))
+        tool = args[0]
+        if len(args) > 1:
+            ui.setconfig("merge-tools", tool + '.args', ' '.join(args[1:]))
+        tools.insert(0, (None, tool)) # 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