Skip to content
Snippets Groups Projects
Commit e28cb3a8eb75 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.
parent 62dbfa0f58cc
No related merge requests found
......@@ -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());
}
}
}
......
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