[Request] [+ ] D9652: copies-rust: record "overwritten" information from both side on delete

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Dec 21 22:29:11 UTC 2020


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  With this change, we can ensure every (`dest`, `rev`) points to the same value,
  making a lots of comparison simpler.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -73,6 +73,19 @@
         self.path = None;
     }
 
+    /// Mark pre-existing copy information as "dropped" by a file deletion
+    ///
+    /// Use this when recording copy information from  parent → child edges
+    fn mark_delete_with_pair(&mut self, rev: Revision, other: &Self) {
+        self.overwritten.insert(self.rev);
+        if other.rev != rev {
+            self.overwritten.insert(other.rev);
+        }
+        self.overwritten.extend(other.overwritten.iter().copied());
+        self.rev = rev;
+        self.path = None;
+    }
+
     fn is_overwritten_by(&self, other: &Self) -> bool {
         other.overwritten.contains(&self.rev)
     }
@@ -540,8 +553,10 @@
                         e.get_mut().mark_delete(current_rev)
                     }
                     (Some(mut e1), Some(mut e2)) => {
-                        e1.get_mut().mark_delete(current_rev);
-                        e2.get_mut().mark_delete(current_rev);
+                        let cs1 = e1.get_mut();
+                        let cs2 = e2.get();
+                        cs1.mark_delete_with_pair(current_rev, &cs2);
+                        e2.insert(cs1.clone());
                     }
                 }
             }



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20201221/0e2b95c7/attachment.html>


More information about the Mercurial-patches mailing list