Fix in output

pmeunier
Jun 19, 2023, 9:12 AM
C5MZXLVCVS6JVFYUASM4YH7KCC75D2BH3ARTJ5WCRAVEDQIQSSEQC

Dependencies

  • [2] 3QXUJMZD More detailed display of conflicts
  • [3] PEUUYRZ5 Order of removing paths when outputting a repo
  • [4] UFCZKKLX Upgrading to the latest Sanakirja/Rand
  • [5] H6JR7IAF Fixing a panic when outputting zombie folders
  • [6] YCEZL7VF Moving to temporary paths when outputting
  • [7] 5BRU2RRW Cleanup (debugging a crash related to trees/inodes)
  • [8] 4RQHY7LH Support parsing lowercase base32
  • [9] HBUMCAFV Avoid printing multiple names conflicts more than once
  • [10] RRCSHAYZ Formatting
  • [11] VO5OQW4W Removing anyhow in libpijul
  • [12] 2RXOCWUW Making libpijul deterministic (and getting rid of `rand`)
  • [13] FXEDPLRI Resurrecting tests, and type cleanup (no need for Arc<RwLock<…>> anymore)
  • [14] I24UEJQL Various post-fire fixes
  • [15] GJZWSXHQ Do not remove files not tracked in the new channel when outputting
  • [16] RMDMAYRX Adding a root inode (aka supporting submodules)
  • [17] YN63NUZO Sanakirja 1.0
  • [18] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [19] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [20] ZDK3GNDB Tag transactions (including a massive refactoring of errors)
  • [*] VNBLGT6G Do not output unmodified files when resetting (fix)

Change contents

  • replacement in libpijul/src/output/output.rs at line 7
    [4.672103][4.672103:672154]()
    use crate::fs::{create_new_inode, inode_filename};
    [4.672103]
    [4.672154]
    use crate::fs::create_new_inode;
  • replacement in libpijul/src/output/output.rs at line 258
    [4.13191][2.3405:3406]()
    [4.13191]
    [4.263]
    move_map: HashMap::new(),
  • replacement in libpijul/src/output/output.rs at line 321
    [4.471][4.14112:14158](),[4.14112][4.14112:14158]()
    for (a, b) in state.actual_moves.iter() {
    [4.471]
    [4.14158]
    // Since we did a depth-first search of the output paths, we need
    // to move in reverse order of the search.
    for (a, b) in state.actual_moves.iter().rev() {
    debug!("actual move: {:?} {:?}", a, b);
  • edit in libpijul/src/output/output.rs at line 366
    [4.14836]
    [4.14836]
    move_map: HashMap<Inode, String>,
  • replacement in libpijul/src/output/output.rs at line 398
    [4.15961][4.25563:25662]()
    collect_dead_files::<_, R, P>(&*txn_, graph, self.pending_change_id, Inode::ROOT)?
    [4.15961]
    [4.16049]
    collect_dead_files::<_, R, P>(
    &*txn_,
    graph,
    &self.move_map,
    self.pending_change_id,
    Inode::ROOT,
    )?
  • edit in libpijul/src/output/output.rs at line 529
    [4.20289]
    [4.20289]
    &mut self.move_map,
  • edit in libpijul/src/output/output.rs at line 555
    [4.20967]
    [4.20967]
    debug!("next_files {:?}", next_files);
  • edit in libpijul/src/output/output.rs at line 617
    [22.1501]
    [22.1501]
    use std::borrow::Cow;
  • edit in libpijul/src/output/output.rs at line 629
    [4.679880]
    [4.3632]
    move_map: &mut HashMap<Inode, String>,
  • replacement in libpijul/src/output/output.rs at line 643
    [4.103023][4.79838:79911](),[4.79838][4.79838:79911](),[4.79911][4.680438:680552](),[4.83144][4.680438:680552](),[4.680438][4.680438:680552]()
    if let Some(ref current_name) = inode_filename(&*txn_, inode)? {
    debug!("current_name = {:?}, path = {:?}", current_name, path);
    if current_name != path {
    [4.103023]
    [4.79912]
    if let Some(ref current_name) = inode_filename(&*txn_, inode, move_map)? {
    let actual_path = if let Some(tmp) = tmp.take() {
    Cow::Owned(tmp)
    } else {
    Cow::Borrowed(path)
    };
    debug!(
    "current_name = {:?}, path = {:?}, actual_path = {:?}",
    current_name, path, actual_path
    );
    if current_name.as_str() != &actual_path {
  • edit in libpijul/src/output/output.rs at line 660
    [4.680853][4.680853:680955](),[4.680955][4.3648:3649]()
    let mut tmp_path = path.to_string();
    crate::path::pop(&mut tmp_path);
  • edit in libpijul/src/output/output.rs at line 665
    [4.3959][4.681168:681222](),[4.681168][4.681168:681222](),[4.681223][4.21340:21451]()
    crate::path::push(&mut tmp_path, &s);
    repo.rename(&current_name, &tmp_path)
    .map_err(OutputError::WorkingCopy)?;
  • edit in libpijul/src/output/output.rs at line 667
    [4.1234]
    [4.1234]
    // The parent was already moved
    debug!("tmp {:?}", tmp);
    crate::path::pop(tmp);
  • edit in libpijul/src/output/output.rs at line 671
    [4.1282][4.1282:1358]()
    } else {
    *tmp = Some(tmp_path.clone());
  • replacement in libpijul/src/output/output.rs at line 672
    [4.1376][4.681279:681344](),[4.21451][4.681279:681344](),[4.681279][4.681279:681344]()
    actual_moves.push((tmp_path, path.to_string()));
    [4.1376]
    [4.681344]
    let mut tmp_ = actual_path.to_string();
    crate::path::pop(&mut tmp_);
    crate::path::push(&mut tmp_, &s);
    debug!("rename {:?} {:?}", current_name, tmp_);
    repo.rename(&current_name, &tmp_)
    .map_err(OutputError::WorkingCopy)?;
    move_map.insert(inode, tmp_.to_string());
    actual_moves.push((tmp_.to_string(), actual_path.to_string()));
    *tmp = Some(tmp_);
  • edit in libpijul/src/output/output.rs at line 836
    [4.84535]
    [4.683937]
    move_map: &HashMap<Inode, String>,
  • replacement in libpijul/src/output/output.rs at line 867
    [4.685037][4.121566:121656]()
    dead.insert(id.to_owned(), (*inode_, inode_filename(txn, *inode_)?));
    [4.685037]
    [4.685124]
    dead.insert(
    id.to_owned(),
    (*inode_, inode_filename(txn, *inode_, move_map)?),
    );
  • replacement in libpijul/src/output/output.rs at line 893
    [3.191][3.191:228]()
    let cmp = b.1.1.cmp(&a.1.1);
    [3.191]
    [3.228]
    let cmp = b.1 .1.cmp(&a.1 .1);
  • edit in libpijul/src/output/output.rs at line 927
    [4.686178]
    [4.686178]
    }
    fn inode_filename<T: TreeTxnT>(
    txn: &T,
    inode: Inode,
    tmp: &HashMap<Inode, String>,
    ) -> Result<Option<String>, TreeErr<T::TreeError>> {
    debug!("inode_filename {:?}", inode);
    let mut components = Vec::new();
    let mut current = inode;
    loop {
    if let Some(tmp) = tmp.get(&current) {
    components.push(SmallString::from_str(tmp));
    break;
    }
    match txn.get_revtree(&current, None)? {
    Some(v) => {
    components.push(v.basename.to_owned());
    current = v.parent_inode;
    if current == Inode::ROOT {
    break;
    }
    }
    None => {
    debug!("filename_of_inode: not in tree");
    return Ok(None);
    }
    }
    }
    let mut path = String::new();
    for c in components.iter().rev() {
    if !path.is_empty() {
    path.push('/')
    }
    path.push_str(c.as_str());
    }
    debug!("inode_filename = {:?}", path);
    Ok(Some(path))