Skip to content
Snippets Groups Projects
Commit d0a11175925b authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

copies-rust: record "overwritten" information from both side on delete

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

Differential Revision: https://phab.mercurial-scm.org/D9652
parent ae57e0792c41
No related branches found
No related tags found
No related merge requests found
...@@ -75,6 +75,19 @@ ...@@ -75,6 +75,19 @@
self.path = None; 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 { fn is_overwritten_by(&self, other: &Self) -> bool {
other.overwritten.contains(&self.rev) other.overwritten.contains(&self.rev)
} }
...@@ -535,8 +548,10 @@ ...@@ -535,8 +548,10 @@
e.get_mut().mark_delete(current_rev) e.get_mut().mark_delete(current_rev)
} }
(Some(mut e1), Some(mut e2)) => { (Some(mut e1), Some(mut e2)) => {
e1.get_mut().mark_delete(current_rev); let cs1 = e1.get_mut();
e2.get_mut().mark_delete(current_rev); let cs2 = e2.get();
cs1.mark_delete_with_pair(current_rev, &cs2);
e2.insert(cs1.clone());
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment