Show More
@@ -448,65 +448,64 b' def _filemerge(premerge, repo, mynode, o' | |||
|
448 | 448 | Returns whether the merge is complete, and the return value of the merge. |
|
449 | 449 | """ |
|
450 | 450 | |
|
451 | if True: | |
|
452 | def temp(prefix, ctx): | |
|
453 | pre = "%s~%s." % (os.path.basename(ctx.path()), prefix) | |
|
454 | (fd, name) = tempfile.mkstemp(prefix=pre) | |
|
455 | data = repo.wwritedata(ctx.path(), ctx.data()) | |
|
456 | f = os.fdopen(fd, "wb") | |
|
457 |
|
|
|
458 | f.close() | |
|
459 | return name | |
|
451 | def temp(prefix, ctx): | |
|
452 | pre = "%s~%s." % (os.path.basename(ctx.path()), prefix) | |
|
453 | (fd, name) = tempfile.mkstemp(prefix=pre) | |
|
454 | data = repo.wwritedata(ctx.path(), ctx.data()) | |
|
455 | f = os.fdopen(fd, "wb") | |
|
456 | f.write(data) | |
|
457 | f.close() | |
|
458 | return name | |
|
460 | 459 | |
|
461 |
|
|
|
462 |
|
|
|
460 | if not fco.cmp(fcd): # files identical? | |
|
461 | return True, None | |
|
463 | 462 | |
|
464 |
|
|
|
465 |
|
|
|
466 |
|
|
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
|
472 |
|
|
|
473 |
|
|
|
463 | ui = repo.ui | |
|
464 | fd = fcd.path() | |
|
465 | binary = fcd.isbinary() or fco.isbinary() or fca.isbinary() | |
|
466 | symlink = 'l' in fcd.flags() + fco.flags() | |
|
467 | tool, toolpath = _picktool(repo, ui, fd, binary, symlink) | |
|
468 | if tool in internals and tool.startswith('internal:'): | |
|
469 | # normalize to new-style names (':merge' etc) | |
|
470 | tool = tool[len('internal'):] | |
|
471 | ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" % | |
|
472 | (tool, fd, binary, symlink)) | |
|
474 | 473 | |
|
475 |
|
|
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
|
481 |
|
|
|
482 |
|
|
|
483 |
|
|
|
484 |
|
|
|
474 | if tool in internals: | |
|
475 | func = internals[tool] | |
|
476 | mergetype = func.mergetype | |
|
477 | onfailure = func.onfailure | |
|
478 | precheck = func.precheck | |
|
479 | else: | |
|
480 | func = _xmerge | |
|
481 | mergetype = fullmerge | |
|
482 | onfailure = _("merging %s failed!\n") | |
|
483 | precheck = None | |
|
485 | 484 | |
|
486 |
|
|
|
485 | toolconf = tool, toolpath, binary, symlink | |
|
487 | 486 | |
|
488 |
|
|
|
489 |
|
|
|
487 | if mergetype == nomerge: | |
|
488 | return True, func(repo, mynode, orig, fcd, fco, fca, toolconf) | |
|
490 | 489 | |
|
491 |
|
|
|
492 |
|
|
|
493 |
|
|
|
494 |
|
|
|
490 | if orig != fco.path(): | |
|
491 | ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) | |
|
492 | else: | |
|
493 | ui.status(_("merging %s\n") % fd) | |
|
495 | 494 | |
|
496 |
|
|
|
495 | ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca)) | |
|
497 | 496 | |
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
|
497 | if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, | |
|
498 | toolconf): | |
|
499 | if onfailure: | |
|
500 | ui.warn(onfailure % fd) | |
|
501 | return True, 1 | |
|
503 | 502 | |
|
504 |
|
|
|
505 |
|
|
|
506 |
|
|
|
507 |
|
|
|
508 |
|
|
|
509 |
|
|
|
503 | a = repo.wjoin(fd) | |
|
504 | b = temp("base", fca) | |
|
505 | c = temp("other", fco) | |
|
506 | back = a + ".orig" | |
|
507 | util.copyfile(a, back) | |
|
508 | files = (a, b, c, back) | |
|
510 | 509 | |
|
511 | 510 | r = 1 |
|
512 | 511 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now