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