rust/hg-core/src/copy_tracing.rs
changeset 46582 b0a3ca02d17a
parent 46581 d6d57bfc1a1b
child 46583 8fcf07e6bbb4
--- a/rust/hg-core/src/copy_tracing.rs	Wed Dec 16 11:06:58 2020 +0100
+++ b/rust/hg-core/src/copy_tracing.rs	Wed Dec 16 11:11:05 2020 +0100
@@ -16,7 +16,7 @@
 
 type PathToken = usize;
 
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug)]
 struct CopySource {
     /// revision at which the copy information was added
     rev: Revision,
@@ -93,6 +93,21 @@
     }
 }
 
+// For the same "dest", content generated for a given revision will always be
+// the same.
+impl PartialEq for CopySource {
+    fn eq(&self, other: &Self) -> bool {
+        #[cfg(debug_assertions)]
+        {
+            if self.rev == other.rev {
+                debug_assert!(self.path == other.path);
+                debug_assert!(self.overwritten == other.overwritten);
+            }
+        }
+        self.rev == other.rev
+    }
+}
+
 /// maps CopyDestination to Copy Source (+ a "timestamp" for the operation)
 type InternalPathCopies = OrdMap<PathToken, CopySource>;