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