[Updated] D9494: copies-rust: use the entry API to overwrite deleted entry

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Fri Dec 18 20:05:43 UTC 2020


Closed by commit rHGe166e8a035a7: copies-rust: use the entry API to overwrite deleted entry (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9494?vs=24355&id=24425

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9494/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D9494

AFFECTED FILES
  rust/hg-core/src/copy_tracing.rs

CHANGE DETAILS

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
@@ -523,13 +523,10 @@
                 // propagate this information when merging two
                 // TimeStampedPathCopies object.
                 let deleted = path_map.tokenize(deleted_path);
-                if copies.contains_key(&deleted) {
-                    let ttpc = TimeStampedPathCopy {
-                        rev: current_rev,
-                        path: None,
-                    };
-                    copies.insert(deleted, ttpc);
-                }
+                copies.entry(deleted).and_modify(|old| {
+                    old.rev = current_rev;
+                    old.path = None;
+                });
             }
         }
     }



To: marmoute, #hg-reviewers, Alphare, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201218/34d00585/attachment-0002.html>


More information about the Mercurial-patches mailing list