# HG changeset patch # User Pierre-Yves David # Date 2020-12-02 14:24:10 # Node ID 7d99614b7b778f00998716c050ae3fed60dbd5b5 # Parent fce2f20a54ce41f77cd89ad0db9027b0ba279eee copies-rust: make the comparison aware of the revision being current merged This make no significant performance change in practice (all ±2%) in practice, but it will help us to distinct between some semantically different cases later on. Differential Revision: https://phab.mercurial-scm.org/D9498 diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs --- a/rust/hg-core/src/copy_tracing.rs +++ b/rust/hg-core/src/copy_tracing.rs @@ -431,6 +431,7 @@ pub fn combine_changeset_copies Some(merge_copies_dict( &path_map, + rev, vertex_copies, copies, &changes, @@ -558,6 +559,7 @@ fn add_from_changes bool>( path_map: &TwoWayPathMap, + current_merge: Revision, mut minor: TimeStampedPathCopies, mut major: TimeStampedPathCopies, changes: &ChangedFiles, @@ -571,7 +573,13 @@ fn merge_copies_dict bool>( path_map: &TwoWayPathMap, + current_merge: Revision, changes: &ChangedFiles, oracle: &mut AncestorOracle, dest: &PathToken, src_minor: &TimeStampedPathCopy, src_major: &TimeStampedPathCopy, ) -> MergePick { - if src_major.path == src_minor.path { + if src_major.rev == current_merge { + if src_minor.rev == current_merge { + if src_major.path.is_none() { + // We cannot get different copy information for both p1 and p2 + // from the same revision. Unless this was a + // deletion + MergePick::Any + } else { + unreachable!(); + } + } else { + // The last value comes the current merge, this value -will- win + // eventually. + MergePick::Major + } + } else if src_minor.rev == current_merge { + // The last value comes the current merge, this value -will- win + // eventually. + MergePick::Minor + } else if src_major.path == src_minor.path { // we have the same value, but from other source; if src_major.rev == src_minor.rev { // If the two entry are identical, they are both valid