diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs index 35dc167dfdb2b35d52812f6d37e0167ff23bff32_cnVzdC9oZy1jb3JlL3NyYy9jb3B5X3RyYWNpbmcucnM=..9f48fe25b6bd53997b37985f4c0546bf4631ce87_cnVzdC9oZy1jb3JlL3NyYy9jb3B5X3RyYWNpbmcucnM= 100644 --- a/rust/hg-core/src/copy_tracing.rs +++ b/rust/hg-core/src/copy_tracing.rs @@ -243,6 +243,10 @@ } } + 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 @@ // combine it with data for that revision let vertex_copies = add_from_changes( &mut path_map, + &mut oracle, &parent_copies, &changes, Parent::FirstParent, @@ -410,6 +415,7 @@ // combine it with data for that revision let vertex_copies = add_from_changes( &mut path_map, + &mut oracle, &parent_copies, &changes, Parent::SecondParent, @@ -485,5 +491,5 @@ /// Combine ChangedFiles with some existing PathCopies information and return /// the result -fn add_from_changes( +fn add_from_changes<A: Fn(Revision, Revision) -> bool>( path_map: &mut TwoWayPathMap, @@ -489,4 +495,5 @@ path_map: &mut TwoWayPathMap, + oracle: &mut AncestorOracle<A>, base_copies: &TimeStampedPathCopies, changes: &ChangedFiles, parent: Parent, @@ -521,6 +528,7 @@ } 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 @@ // 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; });