Using state_from_prefix and hash_from_prefix on remotes to complete (or find) hashes and states

pmeunier
Jan 7, 2022, 5:36 PM
TCFJMFFE4RUI3PVIUAARUVKSIUJNSMY5MCVWJ4CZQXNYJ2QIUTBAC

Dependencies

  • [2] DO2Y5TY5 Tag synchronisation
  • [3] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [4] IVLLXQ5Z Improved push/pull reporting
  • [5] 3QGE6HRD Version bump (upgrade to zstd-seekable 0.2, take 2)
  • [6] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [7] VO5OQW4W Removing anyhow in libpijul
  • [8] SMMBFECL Converting to the new patch format "online"

Change contents

  • edit in pijul/src/remote/mod.rs at line 602
    [3.11077]
    [2.10406]
    is_pull: bool,
  • replacement in pijul/src/remote/mod.rs at line 698
    [2.12555][2.12555:12735]()
    if is_tag {
    Ok(CS::State(
    txn.state_from_prefix(&*current_channel.read(), h)?.0,
    ))
    [2.12555]
    [2.12735]
    if is_pull {
    if is_tag {
    Ok(CS::State(
    txn.state_from_prefix(&remote_ref.lock().states, h)?.0,
    ))
    } else {
    Ok(CS::Change(txn.hash_from_prefix_remote(&remote_ref, h)?))
    }
  • replacement in pijul/src/remote/mod.rs at line 707
    [2.12764][2.12764:12831]()
    Ok(CS::Change(txn.hash_from_prefix(h)?.0))
    [2.12764]
    [2.12831]
    if is_tag {
    Ok(CS::State(
    txn.state_from_prefix(&current_channel.read().states, h)?.0,
    ))
    } else {
    Ok(CS::Change(txn.hash_from_prefix(h)?.0))
    }
  • edit in pijul/src/commands/pushpull.rs at line 163
    [3.19645]
    [2.27227]
    false,
  • edit in pijul/src/commands/pushpull.rs at line 360
    [3.21407]
    [2.28444]
    true,
  • replacement in libpijul/src/pristine/sanakirja.rs at line 1254
    [2.41195][2.41195:41228]()
    channel: &Self::Channel,
    [2.41195]
    [2.41228]
    channel: &Self::States,
  • replacement in libpijul/src/pristine/sanakirja.rs at line 1264
    [2.41581][2.41581:41656]()
    for x in btree::iter(&self.txn, &channel.states, Some((&h, None)))
    [2.41581]
    [2.41656]
    for x in btree::iter(&self.txn, &channel, Some((&h, None)))
  • replacement in libpijul/src/pristine/mod.rs at line 664
    [2.44708][2.44708:44741]()
    channel: &Self::Channel,
    [2.44708]
    [2.44741]
    channel: &Self::States,
  • edit in libpijul/src/change.rs at line 32
    [3.36338]
    [3.36338]
    #[error("while retrieving {:?}: {}", hash, err)]
    IoHash {
    err: std::io::Error,
    hash: crate::pristine::Hash,
    },
  • replacement in libpijul/src/change.rs at line 1528
    [3.873911][3.873911:873959]()
    let mut r = std::fs::File::open(file)?;
    [3.873911]
    [3.873959]
    let mut r = std::fs::File::open(file).map_err(|err| if let Some(h) = hash {
    ChangeError::IoHash {
    err,
    hash: *h,
    }
    } else {
    ChangeError::Io(err)
    })?;
  • replacement in libpijul/src/change/change_file.rs at line 41
    [3.91108][3.91108:91156]()
    let mut r = std::fs::File::open(path)?;
    [3.91108]
    [3.91156]
    let mut r = std::fs::File::open(path).map_err(|err| ChangeError::IoHash {
    err,
    hash,
    })?;