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 @@ -243,6 +243,10 @@ impl<'a, A: Fn(Revision, Revision) -> bo } } + fn record_overwrite(&mut self, anc: Revision, desc: Revision) { + self.pairs.insert((anc, desc), true); + } + /// returns `true` if `anc` is an ancestors of `desc`, `false` otherwise fn is_overwrite(&mut self, anc: Revision, desc: Revision) -> bool { if anc > desc { @@ -390,6 +394,7 @@ pub fn combine_changeset_copies bool>( path_map: &mut TwoWayPathMap, + oracle: &mut AncestorOracle, base_copies: &TimeStampedPathCopies, changes: &ChangedFiles, parent: Parent, @@ -521,6 +528,7 @@ fn add_from_changes( } Entry::Occupied(mut slot) => { let mut ttpc = slot.get_mut(); + oracle.record_overwrite(ttpc.rev, current_rev); ttpc.rev = current_rev; ttpc.path = entry; } @@ -534,6 +542,7 @@ fn add_from_changes( // TimeStampedPathCopies object. let deleted = path_map.tokenize(deleted_path); copies.entry(deleted).and_modify(|old| { + oracle.record_overwrite(old.rev, current_rev); old.rev = current_rev; old.path = None; });