##// END OF EJS Templates
filemerge: wrap quotes around tool path
Steve Borho -
r6025:f2335246 default
parent child Browse files
Show More
@@ -43,14 +43,16 b' def _picktool(repo, ui, path, binary, sy'
43 return False
43 return False
44
44
45 # HGMERGE takes precedence
45 # HGMERGE takes precedence
46 if os.environ.get("HGMERGE"):
46 hgmerge = os.environ.get("HGMERGE")
47 return os.environ.get("HGMERGE")
47 if hgmerge:
48 return (hgmerge, hgmerge)
48
49
49 # then patterns
50 # then patterns
50 for pat, tool in ui.configitems("merge-patterns"):
51 for pat, tool in ui.configitems("merge-patterns"):
51 mf = util.matcher(repo.root, "", [pat], [], [])[1]
52 mf = util.matcher(repo.root, "", [pat], [], [])[1]
52 if mf(path) and check(tool, pat, symlink, False):
53 if mf(path) and check(tool, pat, symlink, False):
53 return tool
54 toolpath = _findtool(ui, tool)
55 return (tool, '"' + toolpath + '"')
54
56
55 # then merge tools
57 # then merge tools
56 tools = {}
58 tools = {}
@@ -63,10 +65,12 b' def _picktool(repo, ui, path, binary, sy'
63 if ui.config("ui", "merge"):
65 if ui.config("ui", "merge"):
64 tools.insert(0, (None, ui.config("ui", "merge"))) # highest priority
66 tools.insert(0, (None, ui.config("ui", "merge"))) # highest priority
65 tools.append((None, "hgmerge")) # the old default, if found
67 tools.append((None, "hgmerge")) # the old default, if found
66 tools.append((None, "internal:merge")) # internal merge as last resort
67 for p,t in tools:
68 for p,t in tools:
68 if _findtool(ui, t) and check(t, None, symlink, binary):
69 toolpath = _findtool(ui, t)
69 return t
70 if toolpath and check(t, None, symlink, binary):
71 return (t, '"' + toolpath + '"')
72 # internal merge as last resort
73 return (not (symlink or binary) and "internal:merge" or None, None)
70
74
71 def _eoltype(data):
75 def _eoltype(data):
72 "Guess the EOL type of a file"
76 "Guess the EOL type of a file"
@@ -124,7 +128,7 b' def filemerge(repo, fw, fd, fo, wctx, mc'
124 fca = fcm.ancestor(fco) or repo.filectx(fw, fileid=nullrev)
128 fca = fcm.ancestor(fco) or repo.filectx(fw, fileid=nullrev)
125 binary = isbin(fcm) or isbin(fco) or isbin(fca)
129 binary = isbin(fcm) or isbin(fco) or isbin(fca)
126 symlink = fcm.islink() or fco.islink()
130 symlink = fcm.islink() or fco.islink()
127 tool = _picktool(repo, ui, fw, binary, symlink)
131 tool, toolpath = _picktool(repo, ui, fw, binary, symlink)
128 ui.debug(_("picked tool '%s' for %s (binary %s symlink %s)\n") %
132 ui.debug(_("picked tool '%s' for %s (binary %s symlink %s)\n") %
129 (tool, fw, binary, symlink))
133 (tool, fw, binary, symlink))
130
134
@@ -177,7 +181,6 b' def filemerge(repo, fw, fd, fo, wctx, mc'
177 if tool == "internal:merge":
181 if tool == "internal:merge":
178 r = simplemerge.simplemerge(a, b, c, label=['local', 'other'])
182 r = simplemerge.simplemerge(a, b, c, label=['local', 'other'])
179 else:
183 else:
180 toolpath = _findtool(ui, tool)
181 args = _toolstr(ui, tool, "args", '$local $base $other')
184 args = _toolstr(ui, tool, "args", '$local $base $other')
182 if "$output" in args:
185 if "$output" in args:
183 out, a = a, back # read input from backup, write to original
186 out, a = a, back # read input from backup, write to original
General Comments 0
You need to be logged in to leave comments. Login now