495 orig = original local filename before merge |
495 orig = original local filename before merge |
496 fco = other file context |
496 fco = other file context |
497 fca = ancestor file context |
497 fca = ancestor file context |
498 fcd = local file context for current/destination file |
498 fcd = local file context for current/destination file |
499 |
499 |
500 Returns whether the merge is complete, and the return value of the merge. |
500 Returns whether the merge is complete, the return value of the merge, and |
501 """ |
501 a boolean indicating whether the file was deleted from disk.""" |
502 |
502 |
503 def temp(prefix, ctx): |
503 def temp(prefix, ctx): |
504 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix) |
504 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix) |
505 (fd, name) = tempfile.mkstemp(prefix=pre) |
505 (fd, name) = tempfile.mkstemp(prefix=pre) |
506 data = repo.wwritedata(ctx.path(), ctx.data()) |
506 data = repo.wwritedata(ctx.path(), ctx.data()) |
536 |
536 |
537 toolconf = tool, toolpath, binary, symlink |
537 toolconf = tool, toolpath, binary, symlink |
538 |
538 |
539 if mergetype == nomerge: |
539 if mergetype == nomerge: |
540 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf) |
540 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf) |
541 return True, r |
541 return True, r, deleted |
542 |
542 |
543 if premerge: |
543 if premerge: |
544 if orig != fco.path(): |
544 if orig != fco.path(): |
545 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) |
545 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) |
546 else: |
546 else: |
550 |
550 |
551 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, |
551 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca, |
552 toolconf): |
552 toolconf): |
553 if onfailure: |
553 if onfailure: |
554 ui.warn(onfailure % fd) |
554 ui.warn(onfailure % fd) |
555 return True, 1 |
555 return True, 1, False |
556 |
556 |
557 a = repo.wjoin(fd) |
557 a = repo.wjoin(fd) |
558 b = temp("base", fca) |
558 b = temp("base", fca) |
559 c = temp("other", fco) |
559 c = temp("other", fco) |
560 back = cmdutil.origpath(ui, repo, a) |
560 back = cmdutil.origpath(ui, repo, a) |
571 labels = _formatlabels(repo, fcd, fco, fca, labels) |
571 labels = _formatlabels(repo, fcd, fco, fca, labels) |
572 |
572 |
573 if premerge and mergetype == fullmerge: |
573 if premerge and mergetype == fullmerge: |
574 r = _premerge(repo, toolconf, files, labels=labels) |
574 r = _premerge(repo, toolconf, files, labels=labels) |
575 # complete if premerge successful (r is 0) |
575 # complete if premerge successful (r is 0) |
576 return not r, r |
576 return not r, r, False |
577 |
577 |
578 needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca, |
578 needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca, |
579 toolconf, files, labels=labels) |
579 toolconf, files, labels=labels) |
580 |
580 |
581 if needcheck: |
581 if needcheck: |