Show More
@@ -573,9 +573,11 b' def _fullcopytracing(repo, c1, c2, base)' | |||
|
573 | 573 | for dst, src in copies2.items(): |
|
574 | 574 | inversecopies2.setdefault(src, []).append(dst) |
|
575 | 575 | |
|
576 | copy = {} | |
|
576 | copy1 = {} | |
|
577 | copy2 = {} | |
|
577 | 578 | diverge = {} |
|
578 | renamedelete = {} | |
|
579 | renamedelete1 = {} | |
|
580 | renamedelete2 = {} | |
|
579 | 581 | allsources = set(inversecopies1) | set(inversecopies2) |
|
580 | 582 | for src in allsources: |
|
581 | 583 | dsts1 = inversecopies1.get(src) |
@@ -592,7 +594,8 b' def _fullcopytracing(repo, c1, c2, base)' | |||
|
592 | 594 | # and 'd' and deletes 'a'. |
|
593 | 595 | if dsts1 & dsts2: |
|
594 | 596 | for dst in dsts1 & dsts2: |
|
595 | copy[dst] = src | |
|
597 | copy1[dst] = src | |
|
598 | copy2[dst] = src | |
|
596 | 599 | else: |
|
597 | 600 | diverge[src] = sorted(dsts1 | dsts2) |
|
598 | 601 | elif src in m1 and src in m2: |
@@ -600,18 +603,19 b' def _fullcopytracing(repo, c1, c2, base)' | |||
|
600 | 603 | dsts1 = set(dsts1) |
|
601 | 604 | dsts2 = set(dsts2) |
|
602 | 605 | for dst in dsts1 & dsts2: |
|
603 | copy[dst] = src | |
|
606 | copy1[dst] = src | |
|
607 | copy2[dst] = src | |
|
604 | 608 | # TODO: Handle cases where it was renamed on one side and copied |
|
605 | 609 | # on the other side |
|
606 | 610 | elif dsts1: |
|
607 | 611 | # copied/renamed only on side 1 |
|
608 | 612 | _checksinglesidecopies( |
|
609 | src, dsts1, m1, m2, mb, c2, base, copy, renamedelete | |
|
613 | src, dsts1, m1, m2, mb, c2, base, copy1, renamedelete1 | |
|
610 | 614 | ) |
|
611 | 615 | elif dsts2: |
|
612 | 616 | # copied/renamed only on side 2 |
|
613 | 617 | _checksinglesidecopies( |
|
614 | src, dsts2, m2, m1, mb, c1, base, copy, renamedelete | |
|
618 | src, dsts2, m2, m1, mb, c1, base, copy2, renamedelete2 | |
|
615 | 619 | ) |
|
616 | 620 | |
|
617 | 621 | # find interesting file sets from manifests |
@@ -634,7 +638,9 b' def _fullcopytracing(repo, c1, c2, base)' | |||
|
634 | 638 | divergeset = set() |
|
635 | 639 | for dsts in diverge.values(): |
|
636 | 640 | divergeset.update(dsts) |
|
637 | for dsts in renamedelete.values(): | |
|
641 | for dsts in renamedelete1.values(): | |
|
642 | renamedeleteset.update(dsts) | |
|
643 | for dsts in renamedelete2.values(): | |
|
638 | 644 | renamedeleteset.update(dsts) |
|
639 | 645 | |
|
640 | 646 | repo.ui.debug( |
@@ -643,7 +649,7 b' def _fullcopytracing(repo, c1, c2, base)' | |||
|
643 | 649 | ) |
|
644 | 650 | for f in sorted(fullcopy): |
|
645 | 651 | note = b"" |
|
646 | if f in copy: | |
|
652 | if f in copy1 or f in copy2: | |
|
647 | 653 | note += b"*" |
|
648 | 654 | if f in divergeset: |
|
649 | 655 | note += b"!" |
@@ -657,14 +663,28 b' def _fullcopytracing(repo, c1, c2, base)' | |||
|
657 | 663 | |
|
658 | 664 | repo.ui.debug(b" checking for directory renames\n") |
|
659 | 665 | |
|
660 |
dirmove, movewithdir = _dir_renames(repo, c1, c |
|
|
666 | dirmove1, movewithdir2 = _dir_renames(repo, c1, copy1, copies1, u2) | |
|
667 | dirmove2, movewithdir1 = _dir_renames(repo, c2, copy2, copies2, u1) | |
|
661 | 668 | |
|
662 | return copy, movewithdir, diverge, renamedelete, dirmove | |
|
669 | copy1.update(copy2) | |
|
670 | renamedelete1.update(renamedelete2) | |
|
671 | movewithdir1.update(movewithdir2) | |
|
672 | dirmove1.update(dirmove2) | |
|
673 | ||
|
674 | return copy1, movewithdir1, diverge, renamedelete1, dirmove1 | |
|
663 | 675 | |
|
664 | 676 | |
|
665 |
def _dir_renames(repo, c |
|
|
677 | def _dir_renames(repo, ctx, copy, fullcopy, addedfiles): | |
|
678 | """Finds moved directories and files that should move with them. | |
|
679 | ||
|
680 | ctx: the context for one of the sides | |
|
681 | copy: files copied on the same side (as ctx) | |
|
682 | fullcopy: files copied on the same side (as ctx), including those that | |
|
683 | merge.manifestmerge() won't care about | |
|
684 | addedfiles: added files on the other side (compared to ctx) | |
|
685 | """ | |
|
666 | 686 | # generate a directory move map |
|
667 |
d |
|
|
687 | d = ctx.dirs() | |
|
668 | 688 | invalid = set() |
|
669 | 689 | dirmove = {} |
|
670 | 690 | |
@@ -675,12 +695,9 b' def _dir_renames(repo, c1, c2, copy, ful' | |||
|
675 | 695 | if dsrc in invalid: |
|
676 | 696 | # already seen to be uninteresting |
|
677 | 697 | continue |
|
678 |
elif dsrc in d |
|
|
698 | elif dsrc in d and ddst in d: | |
|
679 | 699 | # directory wasn't entirely moved locally |
|
680 | 700 | invalid.add(dsrc) |
|
681 | elif dsrc in d2 and ddst in d2: | |
|
682 | # directory wasn't entirely moved remotely | |
|
683 | invalid.add(dsrc) | |
|
684 | 701 | elif dsrc in dirmove and dirmove[dsrc] != ddst: |
|
685 | 702 | # files from the same directory moved to two different places |
|
686 | 703 | invalid.add(dsrc) |
@@ -691,7 +708,7 b' def _dir_renames(repo, c1, c2, copy, ful' | |||
|
691 | 708 | for i in invalid: |
|
692 | 709 | if i in dirmove: |
|
693 | 710 | del dirmove[i] |
|
694 |
del d |
|
|
711 | del d, invalid | |
|
695 | 712 | |
|
696 | 713 | if not dirmove: |
|
697 | 714 | return {}, {} |
@@ -705,7 +722,7 b' def _dir_renames(repo, c1, c2, copy, ful' | |||
|
705 | 722 | |
|
706 | 723 | movewithdir = {} |
|
707 | 724 | # check unaccounted nonoverlapping files against directory moves |
|
708 |
for f in |
|
|
725 | for f in addedfiles: | |
|
709 | 726 | if f not in fullcopy: |
|
710 | 727 | for d in dirmove: |
|
711 | 728 | if f.startswith(d): |
General Comments 0
You need to be logged in to leave comments.
Login now