Fixing --features git
[?]
Nov 26, 2020, 6:25 AM
BXD3IQYNMKMI5BTANCF6NZHZP4CKPWADGJMBT2R3WTMKVKONT5QACDependencies
- [2]
I52XSRUHMassive cleanup, and simplification - [3]
UCQD3JDHFix build errors caused by sanakirja 0.14 - [4]
CVAT6LN3Fixing git import, and adding more useful feedback (with `RUST_LOG="pijul=info"`) - [5]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [*]
AXVPNZ2Ncommands/git: fix imports - [*]
L4JXJHWXpijul/*: 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
.changeid_rev_log(&channel.borrow(), None).changeid_reverse_log(&channel.borrow(), None) - replacement in pijul/src/commands/git.rs at line 408
check_alive(&repo.repo.changes, txn, channel, line!())?;check_alive_debug(&repo.repo.changes, txn, channel, line!())?; - replacement in pijul/src/commands/git.rs at line 412
check_alive(&repo.repo.changes, txn, channel, line!())?;check_alive_debug(&repo.repo.changes, txn, channel, line!())?; - edit in pijul/src/commands/git.rs at line 419
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
check_alive(&repo.repo.changes, txn, channel, line!())?;check_alive_debug(&repo.repo.changes, txn, channel, line!())?; - replacement in pijul/src/commands/git.rs at line 648
check_alive(&repo.repo.changes, txn, channel, line!())?;check_alive_debug(&repo.repo.changes, txn, channel, line!())?; - edit in pijul/src/commands/git.rs at line 819
/// 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 checkfor (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
#[cfg(test)] - edit in libpijul/src/pristine/mod.rs at line 653
#[cfg(test)] - replacement in libpijul/src/pristine/mod.rs at line 681
pub(crate) fn debug_root_rev<W: Write, T: TxnT>(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 checkfor (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
debug_root_rev(txn, channel, child.dest.inode_vertex(), &mut f).unwrap();debug_root(txn, channel, child.dest.inode_vertex(), &mut f).unwrap(); - replacement in libpijul/src/lib.rs at line 97
Base32, ChangeId, Channel, ChannelRef, EdgeFlags, Hash, Merkle, MutTxnT, RemoteRef, TxnT,Vertex,Base32, ChangeId, Channel, ChannelRef, EdgeFlags, Hash, Inode, Merkle, MutTxnT, OwnedPathId,RemoteRef, TxnT, Vertex,