##// END OF EJS Templates
filemerge: use util.shellquote when calling merge (issue3581)
Keegan Carruthers-Smith -
r17885:9a2cf955 stable
parent child Browse files
Show More
@@ -72,7 +72,7 b' def _picktool(repo, ui, path, binary, sy'
72 if force:
72 if force:
73 toolpath = _findtool(ui, force)
73 toolpath = _findtool(ui, force)
74 if toolpath:
74 if toolpath:
75 return (force, '"' + toolpath + '"')
75 return (force, util.shellquote(toolpath))
76 else:
76 else:
77 # mimic HGMERGE if given tool not found
77 # mimic HGMERGE if given tool not found
78 return (force, force)
78 return (force, force)
@@ -87,7 +87,7 b' def _picktool(repo, ui, path, binary, sy'
87 mf = match.match(repo.root, '', [pat])
87 mf = match.match(repo.root, '', [pat])
88 if mf(path) and check(tool, pat, symlink, False):
88 if mf(path) and check(tool, pat, symlink, False):
89 toolpath = _findtool(ui, tool)
89 toolpath = _findtool(ui, tool)
90 return (tool, '"' + toolpath + '"')
90 return (tool, util.shellquote(toolpath))
91
91
92 # then merge tools
92 # then merge tools
93 tools = {}
93 tools = {}
@@ -106,7 +106,7 b' def _picktool(repo, ui, path, binary, sy'
106 for p, t in tools:
106 for p, t in tools:
107 if check(t, None, symlink, binary):
107 if check(t, None, symlink, binary):
108 toolpath = _findtool(ui, t)
108 toolpath = _findtool(ui, t)
109 return (t, '"' + toolpath + '"')
109 return (t, util.shellquote(toolpath))
110
110
111 # internal merge or prompt as last resort
111 # internal merge or prompt as last resort
112 if symlink or binary:
112 if symlink or binary:
@@ -255,7 +255,7 b' def _xmerge(repo, mynode, orig, fcd, fco'
255 out, a = a, back # read input from backup, write to original
255 out, a = a, back # read input from backup, write to original
256 replace = dict(local=a, base=b, other=c, output=out)
256 replace = dict(local=a, base=b, other=c, output=out)
257 args = util.interpolate(r'\$', replace, args,
257 args = util.interpolate(r'\$', replace, args,
258 lambda s: '"%s"' % util.localpath(s))
258 lambda s: util.shellquote(util.localpath(s)))
259 r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
259 r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
260 out=ui.fout)
260 out=ui.fout)
261 return True, r
261 return True, r
@@ -773,6 +773,30 b' Merge using tool with a path that must b'
773 # hg stat
773 # hg stat
774 M f
774 M f
775
775
776 Issue3581: Merging a filename that needs to be quoted
777
778 $ beforemerge
779 [merge-tools]
780 false.whatever=
781 true.priority=1
782 true.executable=cat
783 # hg update -C 1
784 $ echo "revision 4" > '"; exit 1; echo "'
785 $ hg commit -Am "revision 4"
786 adding "; exit 1; echo "
787 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
788 $ hg update -C 1 > /dev/null
789 $ echo "revision 5" > '"; exit 1; echo "'
790 $ hg commit -Am "revision 5"
791 adding "; exit 1; echo "
792 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
793 created new head
794 $ hg merge --config merge-tools.true.executable="true" -r 4
795 merging "; exit 1; echo "
796 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
797 (branch merge, don't forget to commit)
798 $ hg update -C 1 > /dev/null
799
776 Merge post-processing
800 Merge post-processing
777
801
778 cat is a bad merge-tool and doesn't change:
802 cat is a bad merge-tool and doesn't change:
General Comments 0
You need to be logged in to leave comments. Login now