diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs
index 13ab69c69030bfa44c95aae3a5d73850f0573338_cnVzdC9oZy1jb3JlL3NyYy9jb3B5X3RyYWNpbmcucnM=..49d50c041d8b617a3be0c1e21ac9e4f0a1e3e5d4_cnVzdC9oZy1jb3JlL3NyYy9jb3B5X3RyYWNpbmcucnM= 100644
--- a/rust/hg-core/src/copy_tracing.rs
+++ b/rust/hg-core/src/copy_tracing.rs
@@ -4,6 +4,7 @@
 use crate::NULL_REVISION;
 
 use im_rc::ordmap::DiffItem;
+use im_rc::ordmap::Entry;
 use im_rc::ordmap::OrdMap;
 
 use std::cmp::Ordering;
@@ -510,11 +511,20 @@
                 // record this information as we will need it to take
                 // the right decision when merging conflicting copy
                 // information. See merge_copies_dict for details.
-                let ttpc = TimeStampedPathCopy {
-                    rev: current_rev,
-                    path: entry,
-                };
-                copies.insert(dest.to_owned(), ttpc);
+                match copies.entry(dest) {
+                    Entry::Vacant(slot) => {
+                        let ttpc = TimeStampedPathCopy {
+                            rev: current_rev,
+                            path: entry,
+                        };
+                        slot.insert(ttpc);
+                    }
+                    Entry::Occupied(mut slot) => {
+                        let mut ttpc = slot.get_mut();
+                        ttpc.rev = current_rev;
+                        ttpc.path = entry;
+                    }
+                }
             }
             Action::Removed(deleted_path) => {
                 // We must drop copy information for removed file.