556 /// |
557 /// |
557 /// In case of conflict, value from "major" will be picked, unless in some |
558 /// In case of conflict, value from "major" will be picked, unless in some |
558 /// cases. See inline documentation for details. |
559 /// cases. See inline documentation for details. |
559 fn merge_copies_dict<A: Fn(Revision, Revision) -> bool>( |
560 fn merge_copies_dict<A: Fn(Revision, Revision) -> bool>( |
560 path_map: &TwoWayPathMap, |
561 path_map: &TwoWayPathMap, |
|
562 current_merge: Revision, |
561 mut minor: TimeStampedPathCopies, |
563 mut minor: TimeStampedPathCopies, |
562 mut major: TimeStampedPathCopies, |
564 mut major: TimeStampedPathCopies, |
563 changes: &ChangedFiles, |
565 changes: &ChangedFiles, |
564 oracle: &mut AncestorOracle<A>, |
566 oracle: &mut AncestorOracle<A>, |
565 ) -> TimeStampedPathCopies { |
567 ) -> TimeStampedPathCopies { |
569 let mut cmp_value = |
571 let mut cmp_value = |
570 |dest: &PathToken, |
572 |dest: &PathToken, |
571 src_minor: &TimeStampedPathCopy, |
573 src_minor: &TimeStampedPathCopy, |
572 src_major: &TimeStampedPathCopy| { |
574 src_major: &TimeStampedPathCopy| { |
573 compare_value( |
575 compare_value( |
574 path_map, changes, oracle, dest, src_minor, src_major, |
576 path_map, |
|
577 current_merge, |
|
578 changes, |
|
579 oracle, |
|
580 dest, |
|
581 src_minor, |
|
582 src_major, |
575 ) |
583 ) |
576 }; |
584 }; |
577 if minor.is_empty() { |
585 if minor.is_empty() { |
578 major |
586 major |
579 } else if major.is_empty() { |
587 } else if major.is_empty() { |
701 |
709 |
702 /// decide which side prevails in case of conflicting values |
710 /// decide which side prevails in case of conflicting values |
703 #[allow(clippy::if_same_then_else)] |
711 #[allow(clippy::if_same_then_else)] |
704 fn compare_value<A: Fn(Revision, Revision) -> bool>( |
712 fn compare_value<A: Fn(Revision, Revision) -> bool>( |
705 path_map: &TwoWayPathMap, |
713 path_map: &TwoWayPathMap, |
|
714 current_merge: Revision, |
706 changes: &ChangedFiles, |
715 changes: &ChangedFiles, |
707 oracle: &mut AncestorOracle<A>, |
716 oracle: &mut AncestorOracle<A>, |
708 dest: &PathToken, |
717 dest: &PathToken, |
709 src_minor: &TimeStampedPathCopy, |
718 src_minor: &TimeStampedPathCopy, |
710 src_major: &TimeStampedPathCopy, |
719 src_major: &TimeStampedPathCopy, |
711 ) -> MergePick { |
720 ) -> MergePick { |
712 if src_major.path == src_minor.path { |
721 if src_major.rev == current_merge { |
|
722 if src_minor.rev == current_merge { |
|
723 if src_major.path.is_none() { |
|
724 // We cannot get different copy information for both p1 and p2 |
|
725 // from the same revision. Unless this was a |
|
726 // deletion |
|
727 MergePick::Any |
|
728 } else { |
|
729 unreachable!(); |
|
730 } |
|
731 } else { |
|
732 // The last value comes the current merge, this value -will- win |
|
733 // eventually. |
|
734 MergePick::Major |
|
735 } |
|
736 } else if src_minor.rev == current_merge { |
|
737 // The last value comes the current merge, this value -will- win |
|
738 // eventually. |
|
739 MergePick::Minor |
|
740 } else if src_major.path == src_minor.path { |
713 // we have the same value, but from other source; |
741 // we have the same value, but from other source; |
714 if src_major.rev == src_minor.rev { |
742 if src_major.rev == src_minor.rev { |
715 // If the two entry are identical, they are both valid |
743 // If the two entry are identical, they are both valid |
716 MergePick::Any |
744 MergePick::Any |
717 } else if oracle.is_overwrite(src_major.rev, src_minor.rev) { |
745 } else if oracle.is_overwrite(src_major.rev, src_minor.rev) { |