Skip to content
Snippets Groups Projects
Commit 154e277d58dd 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 38e42dbecc7b
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,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)
}
......@@ -535,8 +548,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());
}
}
}
......
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