Correctness of the new algorithm for detecting missing contexts
Dependencies
- [2]
OXZVZDQZSimplification of missing context repairs - [3]
VO5OQW4WRemoving anyhow in libpijul - [4]
ZDK3GNDBTag transactions (including a massive refactoring of errors) - [5]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [6]
I24UEJQLVarious post-fire fixes - [*]
ZCPGCKKYFixing a bug where zombie files could be deleted by unrecord, but not their contents
Change contents
- edit in libpijul/src/apply.rs at line 560[8.507][3.962669]
}}struct StackElt {vertex: Vertex<ChangeId>,last_alive: Vertex<ChangeId>,is_on_path: bool,}impl StackElt {fn is_alive(&self) -> bool {self.vertex == self.last_alive - replacement in libpijul/src/apply.rs at line 580
let mut stack = vec![(root.inode_vertex(), true, false)];let mut stack = vec![StackElt {vertex: root.inode_vertex(),last_alive: root.inode_vertex(),is_on_path: false}]; - replacement in libpijul/src/apply.rs at line 588
while let Some((current, alive, on_path)) = stack.pop() {stack.push((current, alive, true));while let Some(elt) = stack.pop() { - replacement in libpijul/src/apply.rs at line 590
let is_first_visit = visited.insert(current);// If `current` is alive and already visited, pass.if visited.contains(&(elt.vertex, elt.vertex)) {continue}// Else, visit its children.stack.push(StackElt { is_on_path: true, .. elt });let is_first_visit = visited.insert((elt.vertex, elt.last_alive)); - replacement in libpijul/src/apply.rs at line 601
if !on_path {if !elt.is_on_path { - replacement in libpijul/src/apply.rs at line 605
for e in iter_adjacent(txn, channel, current, EdgeFlags::empty(), EdgeFlags::all())? {for e in iter_adjacent(txn, channel, elt.vertex, EdgeFlags::empty(), EdgeFlags::all())? { - replacement in libpijul/src/apply.rs at line 611
stack[len - 1].1 = true;stack[len - 1].last_alive = elt.vertex; - replacement in libpijul/src/apply.rs at line 618
stack.push((*child, false, false));stack.push(StackElt {vertex: *child,last_alive: elt.last_alive,is_on_path: false}); - replacement in libpijul/src/apply.rs at line 627
if len >= 2 && stack[len - 1].1 {if let Some(last_on_path) = (&stack[..len - 1]).iter().rev().position(|x| x.2) {if len >= 2 && stack[len - 1].is_alive() {// If `elt` is alive, it doesn't matter which part// `last_alive` the current path comes from, we can stop// here.visited.remove(&(elt.vertex, elt.last_alive));visited.insert((elt.vertex, elt.vertex));// The visited vertex is alive. Change the last_alive of its childrenfor x in &mut stack[len..] {x.last_alive = elt.vertex}if let Some(last_on_path) = (&stack[..len - 1]).iter().rev().position(|x| x.is_on_path) { - replacement in libpijul/src/apply.rs at line 645
if !stack[last_on_path].1 {if let Some(last_alive_on_path) =(&stack[..last_on_path]).iter().rev().position(|x| x.1){let last_alive_on_path = last_on_path - 1 - last_alive_on_path;debug!("repair zombies {:?} {:?}", last_alive_on_path, len - 1);// We need to reconnect, and we can do it now// since we won't have a chance to visit that// edge (because non-PARENT edge we are// inserting now starts from a vertex that is// on the path, which means we've already// pushed all its children onto the stack.).put_graph_with_rev(txn,channel,EdgeFlags::PSEUDO,stack[last_alive_on_path].0,stack[len - 1].0,ChangeId::ROOT,)?;}if !stack[last_on_path].is_alive() {// We need to reconnect, and we can do it now// since we won't have a chance to visit that// edge (because non-PARENT edge we are// inserting now starts from a vertex that is// on the path, which means we've already// pushed all its children onto the stack.).put_graph_with_rev(txn,channel,EdgeFlags::PSEUDO,elt.last_alive,stack[len - 1].vertex,ChangeId::ROOT,)?;