354 repo.wwrite(fd + ".other", fco.data(), fco.flags()) |
354 repo.wwrite(fd + ".other", fco.data(), fco.flags()) |
355 repo.wwrite(fd + ".base", fca.data(), fca.flags()) |
355 repo.wwrite(fd + ".base", fca.data(), fca.flags()) |
356 return False, 1 |
356 return False, 1 |
357 |
357 |
358 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
358 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): |
359 r = 1 |
359 tool, toolpath, binary, symlink = toolconf |
360 if r: |
360 a, b, c, back = files |
361 tool, toolpath, binary, symlink = toolconf |
361 out = "" |
362 a, b, c, back = files |
362 env = {'HG_FILE': fcd.path(), |
363 out = "" |
363 'HG_MY_NODE': short(mynode), |
364 env = {'HG_FILE': fcd.path(), |
364 'HG_OTHER_NODE': str(fco.changectx()), |
365 'HG_MY_NODE': short(mynode), |
365 'HG_BASE_NODE': str(fca.changectx()), |
366 'HG_OTHER_NODE': str(fco.changectx()), |
366 'HG_MY_ISLINK': 'l' in fcd.flags(), |
367 'HG_BASE_NODE': str(fca.changectx()), |
367 'HG_OTHER_ISLINK': 'l' in fco.flags(), |
368 'HG_MY_ISLINK': 'l' in fcd.flags(), |
368 'HG_BASE_ISLINK': 'l' in fca.flags(), |
369 'HG_OTHER_ISLINK': 'l' in fco.flags(), |
369 } |
370 'HG_BASE_ISLINK': 'l' in fca.flags(), |
370 |
371 } |
371 ui = repo.ui |
372 |
372 |
373 ui = repo.ui |
373 args = _toolstr(ui, tool, "args", '$local $base $other') |
374 |
374 if "$output" in args: |
375 args = _toolstr(ui, tool, "args", '$local $base $other') |
375 out, a = a, back # read input from backup, write to original |
376 if "$output" in args: |
376 replace = {'local': a, 'base': b, 'other': c, 'output': out} |
377 out, a = a, back # read input from backup, write to original |
377 args = util.interpolate(r'\$', replace, args, |
378 replace = {'local': a, 'base': b, 'other': c, 'output': out} |
378 lambda s: util.shellquote(util.localpath(s))) |
379 args = util.interpolate(r'\$', replace, args, |
379 cmd = toolpath + ' ' + args |
380 lambda s: util.shellquote(util.localpath(s))) |
380 repo.ui.debug('launching merge tool: %s\n' % cmd) |
381 cmd = toolpath + ' ' + args |
381 r = ui.system(cmd, cwd=repo.root, environ=env) |
382 repo.ui.debug('launching merge tool: %s\n' % cmd) |
382 repo.ui.debug('merge tool returned: %s\n' % r) |
383 r = ui.system(cmd, cwd=repo.root, environ=env) |
383 return True, r |
384 repo.ui.debug('merge tool returned: %s\n' % r) |
|
385 return True, r |
|
386 return False, 0 |
|
387 |
384 |
388 def _formatconflictmarker(repo, ctx, template, label, pad): |
385 def _formatconflictmarker(repo, ctx, template, label, pad): |
389 """Applies the given template to the ctx, prefixed by the label. |
386 """Applies the given template to the ctx, prefixed by the label. |
390 |
387 |
391 Pad is the minimum width of the label prefix, so that multiple markers |
388 Pad is the minimum width of the label prefix, so that multiple markers |