Show More
@@ -493,34 +493,38 b' def _xmerge(repo, mynode, orig, fcd, fco' | |||
|
493 | 493 | repo.ui.warn(_('warning: %s cannot merge change/delete conflict ' |
|
494 | 494 | 'for %s\n') % (tool, fcd.path())) |
|
495 | 495 | return False, 1, None |
|
496 |
unused, |
|
|
496 | unused, unused, unused, back = files | |
|
497 | 497 | a = _workingpath(repo, fcd) |
|
498 | out = "" | |
|
499 | env = {'HG_FILE': fcd.path(), | |
|
500 | 'HG_MY_NODE': short(mynode), | |
|
501 | 'HG_OTHER_NODE': str(fco.changectx()), | |
|
502 |
'HG_ |
|
|
503 | 'HG_MY_ISLINK': 'l' in fcd.flags(), | |
|
504 | 'HG_OTHER_ISLINK': 'l' in fco.flags(), | |
|
505 |
'HG_ |
|
|
506 | } | |
|
507 | ||
|
508 | ui = repo.ui | |
|
498 | b, c = _maketempfiles(repo, fco, fca) | |
|
499 | try: | |
|
500 | out = "" | |
|
501 | env = {'HG_FILE': fcd.path(), | |
|
502 | 'HG_MY_NODE': short(mynode), | |
|
503 | 'HG_OTHER_NODE': str(fco.changectx()), | |
|
504 | 'HG_BASE_NODE': str(fca.changectx()), | |
|
505 | 'HG_MY_ISLINK': 'l' in fcd.flags(), | |
|
506 | 'HG_OTHER_ISLINK': 'l' in fco.flags(), | |
|
507 | 'HG_BASE_ISLINK': 'l' in fca.flags(), | |
|
508 | } | |
|
509 | ui = repo.ui | |
|
509 | 510 | |
|
510 | args = _toolstr(ui, tool, "args", '$local $base $other') | |
|
511 | if "$output" in args: | |
|
512 | out, a = a, back # read input from backup, write to original | |
|
513 | replace = {'local': a, 'base': b, 'other': c, 'output': out} | |
|
514 | args = util.interpolate(r'\$', replace, args, | |
|
515 | lambda s: util.shellquote(util.localpath(s))) | |
|
516 | cmd = toolpath + ' ' + args | |
|
517 | if _toolbool(ui, tool, "gui"): | |
|
518 | repo.ui.status(_('running merge tool %s for file %s\n') % | |
|
519 | (tool, fcd.path())) | |
|
520 | repo.ui.debug('launching merge tool: %s\n' % cmd) | |
|
521 | r = ui.system(cmd, cwd=repo.root, environ=env, blockedtag='mergetool') | |
|
522 | repo.ui.debug('merge tool returned: %s\n' % r) | |
|
523 | return True, r, False | |
|
511 | args = _toolstr(ui, tool, "args", '$local $base $other') | |
|
512 | if "$output" in args: | |
|
513 | out, a = a, back # read input from backup, write to original | |
|
514 | replace = {'local': a, 'base': b, 'other': c, 'output': out} | |
|
515 | args = util.interpolate(r'\$', replace, args, | |
|
516 | lambda s: util.shellquote(util.localpath(s))) | |
|
517 | cmd = toolpath + ' ' + args | |
|
518 | if _toolbool(ui, tool, "gui"): | |
|
519 | repo.ui.status(_('running merge tool %s for file %s\n') % | |
|
520 | (tool, fcd.path())) | |
|
521 | repo.ui.debug('launching merge tool: %s\n' % cmd) | |
|
522 | r = ui.system(cmd, cwd=repo.root, environ=env, blockedtag='mergetool') | |
|
523 | repo.ui.debug('merge tool returned: %s\n' % r) | |
|
524 | return True, r, False | |
|
525 | finally: | |
|
526 | util.unlink(b) | |
|
527 | util.unlink(c) | |
|
524 | 528 | |
|
525 | 529 | def _formatconflictmarker(repo, ctx, template, label, pad): |
|
526 | 530 | """Applies the given template to the ctx, prefixed by the label. |
@@ -603,12 +607,9 b' def _makebackup(repo, ui, fcd, premerge)' | |||
|
603 | 607 | util.copyfile(a, back) |
|
604 | 608 | return back |
|
605 | 609 | |
|
606 |
def _maketempfiles(repo |
|
|
610 | def _maketempfiles(repo, fco, fca): | |
|
607 | 611 | """Writes out `fco` and `fca` as temporary files, so an external merge |
|
608 | 612 | tool may use them. |
|
609 | ||
|
610 | `fcd` is returned as-is, by convention, because it currently doubles as both | |
|
611 | the local version and merge destination. | |
|
612 | 613 | """ |
|
613 | 614 | def temp(prefix, ctx): |
|
614 | 615 | fullbase, ext = os.path.splitext(ctx.path()) |
@@ -620,11 +621,10 b' def _maketempfiles(repo, fcd, fco, fca):' | |||
|
620 | 621 | f.close() |
|
621 | 622 | return name |
|
622 | 623 | |
|
623 | a = repo.wjoin(fcd.path()) | |
|
624 | 624 | b = temp("base", fca) |
|
625 | 625 | c = temp("other", fco) |
|
626 | 626 | |
|
627 |
return |
|
|
627 | return b, c | |
|
628 | 628 | |
|
629 | 629 | def _filemerge(premerge, repo, mynode, orig, fcd, fco, fca, labels=None): |
|
630 | 630 | """perform a 3-way merge in the working directory |
@@ -687,7 +687,7 b' def _filemerge(premerge, repo, mynode, o' | |||
|
687 | 687 | return True, 1, False |
|
688 | 688 | |
|
689 | 689 | back = _makebackup(repo, ui, fcd, premerge) |
|
690 | files = _maketempfiles(repo, fcd, fco, fca) + (back,) | |
|
690 | files = (None, None, None, back) | |
|
691 | 691 | r = 1 |
|
692 | 692 | try: |
|
693 | 693 | markerstyle = ui.config('ui', 'mergemarkers') |
@@ -715,8 +715,6 b' def _filemerge(premerge, repo, mynode, o' | |||
|
715 | 715 | finally: |
|
716 | 716 | if not r and back is not None: |
|
717 | 717 | util.unlink(back) |
|
718 | util.unlink(files[1]) | |
|
719 | util.unlink(files[2]) | |
|
720 | 718 | |
|
721 | 719 | def _check(repo, r, ui, tool, fcd, files): |
|
722 | 720 | fd = fcd.path() |
General Comments 0
You need to be logged in to leave comments.
Login now