diff mercurial/filemerge.py @ 17885:9a2cf955db84 stable

filemerge: use util.shellquote when calling merge (issue3581)
author Keegan Carruthers-Smith <keegancsmith@fb.com>
date Fri, 26 Oct 2012 12:02:58 -0700
parents c655e4acaa82
children d084df89d948
line wrap: on
line diff
--- a/mercurial/filemerge.py	Tue Oct 30 16:46:52 2012 -0500
+++ b/mercurial/filemerge.py	Fri Oct 26 12:02:58 2012 -0700
@@ -72,7 +72,7 @@
     if force:
         toolpath = _findtool(ui, force)
         if toolpath:
-            return (force, '"' + toolpath + '"')
+            return (force, util.shellquote(toolpath))
         else:
             # mimic HGMERGE if given tool not found
             return (force, force)
@@ -87,7 +87,7 @@
         mf = match.match(repo.root, '', [pat])
         if mf(path) and check(tool, pat, symlink, False):
             toolpath = _findtool(ui, tool)
-            return (tool, '"' + toolpath + '"')
+            return (tool, util.shellquote(toolpath))
 
     # then merge tools
     tools = {}
@@ -106,7 +106,7 @@
     for p, t in tools:
         if check(t, None, symlink, binary):
             toolpath = _findtool(ui, t)
-            return (t, '"' + toolpath + '"')
+            return (t, util.shellquote(toolpath))
 
     # internal merge or prompt as last resort
     if symlink or binary:
@@ -255,7 +255,7 @@
             out, a = a, back # read input from backup, write to original
         replace = dict(local=a, base=b, other=c, output=out)
         args = util.interpolate(r'\$', replace, args,
-                                lambda s: '"%s"' % util.localpath(s))
+                                lambda s: util.shellquote(util.localpath(s)))
         r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
                         out=ui.fout)
         return True, r