Fixing --features git

[?]
Nov 26, 2020, 6:25 AM
BXD3IQYNMKMI5BTANCF6NZHZP4CKPWADGJMBT2R3WTMKVKONT5QAC

Dependencies

  • [2] I52XSRUH Massive cleanup, and simplification
  • [3] UCQD3JDH Fix build errors caused by sanakirja 0.14
  • [4] CVAT6LN3 Fixing git import, and adding more useful feedback (with `RUST_LOG="pijul=info"`)
  • [5] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [*] AXVPNZ2N commands/git: fix imports
  • [*] L4JXJHWX pijul/*: reorganize imports and remove extern crate

Change contents

  • edit in pijul/src/commands/git.rs at line 8
    [7.16]
    [8.2264]
    use libpijul::pristine::*;
  • replacement in pijul/src/commands/git.rs at line 238
    [3.144337][3.144337:144396]()
    .changeid_rev_log(&channel.borrow(), None)
    [3.144337]
    [3.144396]
    .changeid_reverse_log(&channel.borrow(), None)
  • replacement in pijul/src/commands/git.rs at line 408
    [3.150512][3.150512:150581]()
    check_alive(&repo.repo.changes, txn, channel, line!())?;
    [3.150512]
    [3.150581]
    check_alive_debug(&repo.repo.changes, txn, channel, line!())?;
  • replacement in pijul/src/commands/git.rs at line 412
    [3.150649][3.150649:150714]()
    check_alive(&repo.repo.changes, txn, channel, line!())?;
    [3.150649]
    [3.150714]
    check_alive_debug(&repo.repo.changes, txn, channel, line!())?;
  • edit in pijul/src/commands/git.rs at line 419
    [3.150885][3.150885:151008]()
    if repo.check > 0 && repo.n % repo.check == 0 && !to_apply.is_empty() {
    txn.check_channel_log(&channel);
    }
  • replacement in pijul/src/commands/git.rs at line 436
    [3.151569][3.151569:151638]()
    check_alive(&repo.repo.changes, txn, channel, line!())?;
    [3.151569]
    [3.151638]
    check_alive_debug(&repo.repo.changes, txn, channel, line!())?;
  • replacement in pijul/src/commands/git.rs at line 648
    [3.159718][3.159718:159783]()
    check_alive(&repo.repo.changes, txn, channel, line!())?;
    [3.159718]
    [3.159783]
    check_alive_debug(&repo.repo.changes, txn, channel, line!())?;
  • edit in pijul/src/commands/git.rs at line 819
    [3.165170][3.165170:167862]()
    /// Check that each alive vertex in the graph is reachable, and vice-versa.
    fn check_alive<T: TxnT, C: libpijul::changestore::ChangeStore>(
    changes: &C,
    txn: &T,
    channel: &ChannelRef<T>,
    line: u32,
    ) -> Result<(), anyhow::Error> {
    let (alive, reachable) = txn.check_alive(&channel);
    let mut h = BTreeSet::new();
    if !alive.is_empty() {
    for (k, file) in alive.iter() {
    debug!("alive = {:?}, file = {:?}", k, file);
    h.insert(file);
    }
    }
    if !reachable.is_empty() {
    for (k, file) in reachable.iter() {
    debug!("reachable = {:?}, file = {:?}", k, file);
    h.insert(file);
    }
    }
    for file in h.iter() {
    let file_ = file.unwrap().start_pos();
    let mut f = std::fs::File::create(&format!("debug_{:?}", file_))?;
    let graph = libpijul::alive::retrieve::retrieve(txn, &channel.borrow(), file_);
    graph.debug(changes, txn, &channel.borrow(), false, false, &mut f)?;
    let mut f = std::fs::File::create(&format!("debug_all_{:?}", file_))?;
    txn.debug_root(channel, file.unwrap(), &mut f)?;
    }
    if !h.is_empty() {
    panic!("alive call line {}", line);
    }
    Ok(())
    }
    /// Check that each inode in the inodes table maps to an alive vertex,
    /// and that each inode in the tree table is reachable by only one
    /// path.
    fn check_tree_inodes<T: TxnT>(txn: &T, channel: &Channel<T>) {
    // Sanity check
    for (inode, vertex) in txn.iter_inodes() {
    let mut inode_ = inode;
    while !inode_.is_root() {
    if let Some(next) = txn.get_revtree(inode_, None) {
    inode_ = next.parent_inode;
    } else {
    panic!("inode = {:?}, inode_ = {:?}", inode, inode_);
    }
    }
    if !txn.is_alive(&channel, vertex.inode_vertex()) {
    for e in txn.iter_adjacent(
    &channel,
    vertex.inode_vertex(),
    EdgeFlags::empty(),
    EdgeFlags::all(),
    ) {
    error!("{:?} {:?} {:?}", inode, vertex, e)
    }
    panic!(
    "inode {:?}, vertex {:?}, is not alive, {:?}",
    inode,
    vertex,
    txn.tree_path(vertex)
    )
    }
    }
    let mut h = HashMap::new();
    let id0 = OwnedPathId {
    parent_inode: Inode::ROOT,
    basename: libpijul::small_string::SmallString::new(),
    };
    for (id, inode) in txn.iter_tree(id0, None) {
    if let Some(inode_) = h.insert(id.clone(), inode) {
    panic!("id {:?} maps to two inodes: {:?} {:?}", id, inode, inode_);
    }
    }
    }
  • edit in libpijul/src/pristine/mod.rs at line 582
    [3.612336][2.45938:45951]()
    #[cfg(test)]
  • edit in libpijul/src/pristine/mod.rs at line 653
    [2.48272][2.48272:48285]()
    #[cfg(test)]
  • replacement in libpijul/src/pristine/mod.rs at line 681
    [3.616291][2.49042:49091]()
    pub(crate) fn debug_root_rev<W: Write, T: TxnT>(
    [3.616291]
    [2.49091]
    pub(crate) fn debug_root<W: Write, T: TxnT>(
  • edit in libpijul/src/pristine/mod.rs at line 1312
    [2.55588]
    /// Check that each inode in the inodes table maps to an alive vertex,
    /// and that each inode in the tree table is reachable by only one
    /// path.
    pub fn check_tree_inodes<T: TxnT>(txn: &T, channel: &Channel<T>) {
    // Sanity check
    for (inode, vertex) in txn.iter_inodes() {
    let mut inode_ = inode;
    while !inode_.is_root() {
    if let Some(next) = txn.get_revtree(inode_, None) {
    inode_ = next.parent_inode;
    } else {
    panic!("inode = {:?}, inode_ = {:?}", inode, inode_);
    }
    }
    if !is_alive(txn, &channel, vertex.inode_vertex()) {
    for e in iter_adjacent(
    txn,
    &channel,
    vertex.inode_vertex(),
    EdgeFlags::empty(),
    EdgeFlags::all(),
    ) {
    error!("{:?} {:?} {:?}", inode, vertex, e)
    }
    panic!(
    "inode {:?}, vertex {:?}, is not alive, {:?}",
    inode,
    vertex,
    tree_path(txn, vertex)
    )
    }
    }
    let mut h = HashMap::new();
    let id0 = OwnedPathId {
    parent_inode: Inode::ROOT,
    basename: crate::small_string::SmallString::new(),
    };
    for (id, inode) in txn.iter_tree(id0, None) {
    if let Some(inode_) = h.insert(id.clone(), inode) {
    panic!("id {:?} maps to two inodes: {:?} {:?}", id, inode, inode_);
    }
    }
    }
    /// Check that each alive vertex in the graph is reachable, and vice-versa.
    pub fn check_alive_debug<T: TxnT, C: crate::changestore::ChangeStore>(
    changes: &C,
    txn: &T,
    channel: &ChannelRef<T>,
    line: u32,
    ) -> Result<(), anyhow::Error> {
    let (alive, reachable) = crate::pristine::check_alive(txn, &channel);
    let mut h = HashSet::new();
    if !alive.is_empty() {
    for (k, file) in alive.iter() {
    debug!("alive = {:?}, file = {:?}", k, file);
    h.insert(file);
    }
    }
    if !reachable.is_empty() {
    for (k, file) in reachable.iter() {
    debug!("reachable = {:?}, file = {:?}", k, file);
    h.insert(file);
    }
    }
    for file in h.iter() {
    let file_ = file.unwrap().start_pos();
    let mut f = std::fs::File::create(&format!("debug_{:?}", file_))?;
    let graph = crate::alive::retrieve::retrieve(txn, &channel.borrow(), file_);
    graph.debug(changes, txn, &channel.borrow(), false, false, &mut f)?;
    let mut f = std::fs::File::create(&format!("debug_all_{:?}", file_))?;
    let channel = channel.borrow();
    debug_root(txn, &channel, file.unwrap(), &mut f)?;
    }
    if !h.is_empty() {
    panic!("alive call line {}", line);
    }
    Ok(())
    }
  • replacement in libpijul/src/output/mod.rs at line 100
    [3.688970][2.56808:56894]()
    debug_root_rev(txn, channel, child.dest.inode_vertex(), &mut f).unwrap();
    [3.688970]
    [3.689072]
    debug_root(txn, channel, child.dest.inode_vertex(), &mut f).unwrap();
  • replacement in libpijul/src/lib.rs at line 97
    [2.60252][2.60252:60358]()
    Base32, ChangeId, Channel, ChannelRef, EdgeFlags, Hash, Merkle, MutTxnT, RemoteRef, TxnT,
    Vertex,
    [2.60252]
    [2.60358]
    Base32, ChangeId, Channel, ChannelRef, EdgeFlags, Hash, Inode, Merkle, MutTxnT, OwnedPathId,
    RemoteRef, TxnT, Vertex,