Unrecord: restore files *after* having unapplied the *entire* change

[?]
Dec 6, 2020, 2:44 PM
KQTD46KVVWMJ3W6O55BEJLCVTNTDLUH6QT46AEFT7OU2SELXG4IAC

Dependencies

  • [2] VO5OQW4W Removing anyhow in libpijul
  • [3] I52XSRUH Massive cleanup, and simplification
  • [4] WZVCLZKY address clippy lints
  • [5] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [*] FBXYP7QM Forgot to add remote::http
  • [*] Q45QHPO4 Feedback on network stuff

Change contents

  • edit in pijul/src/remote/http.rs at line 57
    [7.1313]
    [8.1396]
    debug!("err for {:?}", c);
  • edit in libpijul/src/unrecord/working_copy.rs at line 121
    [3.230218]
    [3.230218]
    debug!("deleted: {:?}", e.introduced_by);
  • edit in libpijul/src/unrecord/mod.rs at line 158
    [3.2289]
    [3.235597]
    for change_ in change.changes.iter().rev().flat_map(|r| r.rev_iter()) {
    match *change_ {
    Atom::EdgeMap(ref newedges) if newedges.edges[0].flag.contains(EdgeFlags::FOLDER) => {
    if newedges.edges[0].flag.contains(EdgeFlags::DELETED) {
    let mut f = std::fs::File::create("debug_unrecord").unwrap();
    crate::pristine::debug(txn, &channel, &mut f).unwrap();
    working_copy::undo_file_deletion(txn, changes, channel, change_id, newedges)?
    } else {
    working_copy::undo_file_reinsertion::<C, _>(txn, change_id, newedges)?
    }
    }
    Atom::NewVertex(ref new_vertex)
    if new_vertex.flag.contains(EdgeFlags::FOLDER)
    && new_vertex.down_context.is_empty() =>
    {
    working_copy::undo_file_addition(txn, change_id, new_vertex)
    .map_err(UnrecordError::Txn)?;
    }
    _ => {}
    }
    }
  • edit in libpijul/src/unrecord/mod.rs at line 274
    [3.238598][3.238598:238605](),[3.238605][3.2290:2495](),[3.2495][3.238828:238829](),[3.238828][3.238828:238829](),[3.238829][2.10025:10124]()
    }
    if new_vertex.flag.contains(EdgeFlags::FOLDER) && new_vertex.down_context.is_empty() {
    // let mut f = std::fs::File::create("debug_unrecord")?;
    // txn.debug(&channel, &mut f).unwrap();
    working_copy::undo_file_addition(txn, change_id, new_vertex).map_err(UnrecordError::Txn)?;
  • edit in libpijul/src/unrecord/mod.rs at line 367
    [3.241637][3.241637:241870](),[3.241870][2.10294:10377](),[2.10377][3.241945:241961](),[3.241945][3.241945:241961]()
    if newedges.edges[0].flag.contains(EdgeFlags::FOLDER) {
    if newedges.edges[0].flag.contains(EdgeFlags::DELETED) {
    working_copy::undo_file_deletion(txn, changes, channel, change_id, newedges)?
    } else {
    working_copy::undo_file_reinsertion::<P, _>(txn, change_id, newedges)?
    }
    }