Mercurial > public > mercurial-scm > hg
comparison mercurial/filemerge.py @ 11148:a912f26777d3
merge: introduce tool.check parameter
tool.check is a list of check options, and can be used in place of
tool.checkchanged and tool.checkconflicts:
Equivalences:
tool.checkchanged = yes
tool.checkconflicts = no
tool.check = changed
tool.checkchanged = no
tool.checkconflicts = yes
tool.check = conflicts
tool.checkchanged = yes
tool.checkconflicts = yes
tool.check = changed, conflicts
Add _toollist() wrapper for ui.configlist() to implement this consistently.
checkchanged and checkconflicts are still supported, but check is
preferred for implementing new check options.
author | David Champion <dgc@uchicago.edu> |
---|---|
date | Mon, 10 May 2010 11:04:56 -0500 |
parents | 523330d567cf |
children | d3c1eddfdbcf |
comparison
equal
deleted
inserted
replaced
11147:bdc8f048166e | 11148:a912f26777d3 |
---|---|
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 |