13 def _toolstr(ui, tool, part, default=""): |
13 def _toolstr(ui, tool, part, default=""): |
14 return ui.config("merge-tools", tool + "." + part, default) |
14 return ui.config("merge-tools", tool + "." + part, default) |
15 |
15 |
16 def _toolbool(ui, tool, part, default=False): |
16 def _toolbool(ui, tool, part, default=False): |
17 return ui.configbool("merge-tools", tool + "." + part, default) |
17 return ui.configbool("merge-tools", tool + "." + part, default) |
|
18 |
|
19 def _toollist(ui, tool, part, default=[]): |
|
20 return ui.configlist("merge-tools", tool + "." + part, default) |
18 |
21 |
19 _internal = ['internal:' + s |
22 _internal = ['internal:' + s |
20 for s in 'fail local other merge prompt dump'.split()] |
23 for s in 'fail local other merge prompt dump'.split()] |
21 |
24 |
22 def _findtool(ui, tool): |
25 def _findtool(ui, tool): |
221 replace = dict(local=a, base=b, other=c, output=out) |
224 replace = dict(local=a, base=b, other=c, output=out) |
222 args = re.sub("\$(local|base|other|output)", |
225 args = re.sub("\$(local|base|other|output)", |
223 lambda x: '"%s"' % util.localpath(replace[x.group()[1:]]), args) |
226 lambda x: '"%s"' % util.localpath(replace[x.group()[1:]]), args) |
224 r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env) |
227 r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env) |
225 |
228 |
226 if not r and _toolbool(ui, tool, "checkconflicts"): |
229 if not r and (_toolbool(ui, tool, "checkconflicts") or |
|
230 'conflicts' in _toollist(ui, tool, "check")): |
227 if re.match("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data()): |
231 if re.match("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data()): |
228 r = 1 |
232 r = 1 |
229 |
233 |
230 if not r and _toolbool(ui, tool, "checkchanged"): |
234 if not r and (_toolbool(ui, tool, "checkchanged") or |
|
235 'changed' in _toollist(ui, tool, "check")): |
231 if filecmp.cmp(repo.wjoin(fd), back): |
236 if filecmp.cmp(repo.wjoin(fd), back): |
232 if ui.promptchoice(_(" output file %s appears unchanged\n" |
237 if ui.promptchoice(_(" output file %s appears unchanged\n" |
233 "was merge successful (yn)?") % fd, |
238 "was merge successful (yn)?") % fd, |
234 (_("&Yes"), _("&No")), 1): |
239 (_("&Yes"), _("&No")), 1): |
235 r = 1 |
240 r = 1 |