535 else: |
535 else: |
536 _checkcollision(repo, m1, actions) |
536 _checkcollision(repo, m1, actions) |
537 |
537 |
538 return actions, diverge, renamedelete |
538 return actions, diverge, renamedelete |
539 |
539 |
|
540 def _resolvetrivial(repo, wctx, mctx, ancestor, actions): |
|
541 """Resolves false conflicts where the nodeid changed but the content |
|
542 remained the same.""" |
|
543 |
|
544 cdactions = [] |
|
545 for action in actions['cd']: |
|
546 f = action[0] |
|
547 if f in ancestor and not wctx[f].cmp(ancestor[f]): |
|
548 # local did change but ended up with same content |
|
549 actions['r'].append((f, None, "prompt same")) |
|
550 else: |
|
551 cdactions.append(action) |
|
552 actions['cd'] = cdactions |
|
553 |
|
554 dcactions = [] |
|
555 for action in actions['dc']: |
|
556 f = action[0] |
|
557 if f in ancestor and not mctx[f].cmp(ancestor[f]): |
|
558 # remote did change but ended up with same content |
|
559 pass # don't get = keep local deleted |
|
560 else: |
|
561 dcactions.append(action) |
|
562 actions['dc'] = dcactions |
|
563 |
540 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial, |
564 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial, |
541 acceptremote, followcopies): |
565 acceptremote, followcopies): |
542 "Calculate the actions needed to merge mctx into wctx using ancestors" |
566 "Calculate the actions needed to merge mctx into wctx using ancestors" |
543 |
567 |
544 if len(ancestors) == 1: # default |
568 if len(ancestors) == 1: # default |
612 (f, m)) |
636 (f, m)) |
613 actions[m].append(l[0]) |
637 actions[m].append(l[0]) |
614 continue |
638 continue |
615 repo.ui.note(_('end of auction\n\n')) |
639 repo.ui.note(_('end of auction\n\n')) |
616 |
640 |
|
641 _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) |
|
642 |
617 # Prompt and create actions. TODO: Move this towards resolve phase. |
643 # Prompt and create actions. TODO: Move this towards resolve phase. |
618 for f, args, msg in sorted(actions['cd']): |
644 for f, args, msg in sorted(actions['cd']): |
619 if f in ancestors[0] and not wctx[f].cmp(ancestors[0][f]): |
645 if repo.ui.promptchoice( |
620 # local did change but ended up with same content |
|
621 actions['r'].append((f, None, "prompt same")) |
|
622 elif repo.ui.promptchoice( |
|
623 _("local changed %s which remote deleted\n" |
646 _("local changed %s which remote deleted\n" |
624 "use (c)hanged version or (d)elete?" |
647 "use (c)hanged version or (d)elete?" |
625 "$$ &Changed $$ &Delete") % f, 0): |
648 "$$ &Changed $$ &Delete") % f, 0): |
626 actions['r'].append((f, None, "prompt delete")) |
649 actions['r'].append((f, None, "prompt delete")) |
627 else: |
650 else: |
628 actions['a'].append((f, None, "prompt keep")) |
651 actions['a'].append((f, None, "prompt keep")) |
629 del actions['cd'][:] |
652 del actions['cd'][:] |
630 |
653 |
631 for f, args, msg in sorted(actions['dc']): |
654 for f, args, msg in sorted(actions['dc']): |
632 flags, = args |
655 flags, = args |
633 if f in ancestors[0] and not mctx[f].cmp(ancestors[0][f]): |
656 if repo.ui.promptchoice( |
634 # remote did change but ended up with same content |
|
635 pass # don't get = keep local deleted |
|
636 elif repo.ui.promptchoice( |
|
637 _("remote changed %s which local deleted\n" |
657 _("remote changed %s which local deleted\n" |
638 "use (c)hanged version or leave (d)eleted?" |
658 "use (c)hanged version or leave (d)eleted?" |
639 "$$ &Changed $$ &Deleted") % f, 0) == 0: |
659 "$$ &Changed $$ &Deleted") % f, 0) == 0: |
640 actions['g'].append((f, (flags,), "prompt recreating")) |
660 actions['g'].append((f, (flags,), "prompt recreating")) |
641 del actions['dc'][:] |
661 del actions['dc'][:] |