Skip to content
Snippets Groups Projects
Commit f2335246e5c7 authored by Steve Borho's avatar Steve Borho
Browse files

filemerge: wrap quotes around tool path

parent 3121f0feefb4
No related branches found
No related tags found
No related merge requests found
......@@ -43,10 +43,11 @@
return False
# HGMERGE takes precedence
if os.environ.get("HGMERGE"):
return os.environ.get("HGMERGE")
hgmerge = os.environ.get("HGMERGE")
if hgmerge:
return (hgmerge, hgmerge)
# then patterns
for pat, tool in ui.configitems("merge-patterns"):
mf = util.matcher(repo.root, "", [pat], [], [])[1]
if mf(path) and check(tool, pat, symlink, False):
......@@ -48,9 +49,10 @@
# then patterns
for pat, tool in ui.configitems("merge-patterns"):
mf = util.matcher(repo.root, "", [pat], [], [])[1]
if mf(path) and check(tool, pat, symlink, False):
return tool
toolpath = _findtool(ui, tool)
return (tool, '"' + toolpath + '"')
# then merge tools
tools = {}
......@@ -63,5 +65,4 @@
if ui.config("ui", "merge"):
tools.insert(0, (None, ui.config("ui", "merge"))) # highest priority
tools.append((None, "hgmerge")) # the old default, if found
tools.append((None, "internal:merge")) # internal merge as last resort
for p,t in tools:
......@@ -67,6 +68,9 @@
for p,t in tools:
if _findtool(ui, t) and check(t, None, symlink, binary):
return t
toolpath = _findtool(ui, t)
if toolpath and check(t, None, symlink, binary):
return (t, '"' + toolpath + '"')
# internal merge as last resort
return (not (symlink or binary) and "internal:merge" or None, None)
def _eoltype(data):
"Guess the EOL type of a file"
......@@ -124,7 +128,7 @@
fca = fcm.ancestor(fco) or repo.filectx(fw, fileid=nullrev)
binary = isbin(fcm) or isbin(fco) or isbin(fca)
symlink = fcm.islink() or fco.islink()
tool = _picktool(repo, ui, fw, binary, symlink)
tool, toolpath = _picktool(repo, ui, fw, binary, symlink)
ui.debug(_("picked tool '%s' for %s (binary %s symlink %s)\n") %
(tool, fw, binary, symlink))
......@@ -177,7 +181,6 @@
if tool == "internal:merge":
r = simplemerge.simplemerge(a, b, c, label=['local', 'other'])
else:
toolpath = _findtool(ui, tool)
args = _toolstr(ui, tool, "args", '$local $base $other')
if "$output" in args:
out, a = a, back # read input from backup, write to original
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment