Fix a panic when switching between channels that have different files

[?]
Feb 26, 2021, 8:31 AM
MDADYULS5AWVMTJDGYCGNQTN6T7XJDRUBDTFILDY5MLF6I2PE5NAC

Dependencies

  • [2] YN63NUZO Sanakirja 1.0
  • [3] HMMMKONL Fixing alive vertices
  • [4] QMTANHVN Reset: only output changed files
  • [5] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [6] VNBLGT6G Do not output unmodified files when resetting (fix)
  • [7] XA23FMQM Reset only files that have been modified
  • [8] LGEJSLTY Fixing output (including its uses in reset and pull)
  • [9] VO5OQW4W Removing anyhow in libpijul
  • [10] 27PYHR6L Making the get_latest_touch function (useful to make archives) public in libpijul
  • [11] 3AMEP2Y5 More convenient interface for channels
  • [12] I52XSRUH Massive cleanup, and simplification
  • [13] BXD3IQYN Fixing --features git
  • [14] 3KRGVQFU Do not update the mtime of unmodified files
  • [15] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [16] GHO6DWPI Refactoring iterators
  • [*] MU5GSJAW Partial push and pull (WARNING: breaks the existing protocol)
  • [*] K6GWUOD5 Styling progress bars

Change contents

  • replacement in pijul/src/commands/reset.rs at line 127
    [3.1394][3.1394:1395]()
    [3.1394]
    [3.1395]
    let mut paths = Vec::with_capacity(inodes.len());
  • replacement in pijul/src/commands/reset.rs at line 129
    [3.1438][3.1438:1499]()
    let (path, _) = libpijul::fs::find_path(
    [3.1438]
    [3.1499]
    if let Some((path, _)) = libpijul::fs::find_path(
  • replacement in pijul/src/commands/reset.rs at line 135
    [3.1672][3.1672:1696]()
    )?;
    [3.1672]
    [3.1696]
    )? {
    paths.push(path)
    } else {
    paths.clear();
    break;
    }
    }
    for path in paths.iter() {
  • edit in pijul/src/commands/reset.rs at line 153
    [3.2075]
    [3.101179]
    if paths.is_empty() {
    txn.output_repository_no_pending(
    &mut repo.working_copy,
    &repo.changes,
    &mut channel,
    "",
    true,
    None,
    )?;
    }
  • replacement in pijul/src/commands/pushpull.rs at line 458
    [3.343][3.343:369](),[3.369][2.12019:12120]()
    touched_paths
    .push(libpijul::fs::find_path(&repo.changes, &txn, &channel.borrow(), false, *i)?.0)
    [3.343]
    [3.469]
    if let Some((path, _)) =
    libpijul::fs::find_path(&repo.changes, &txn, &channel.borrow(), false, *i)?
    {
    touched_paths.push(path)
    } else {
    touched_paths.clear();
    break;
    }
  • edit in pijul/src/commands/pushpull.rs at line 484
    [18.11136]
    [19.2211]
    if touched_paths.is_empty() {
    txn.output_repository_no_pending(
    &mut repo.working_copy,
    &repo.changes,
    &mut channel,
    "",
    true,
    None,
    )?;
    }
  • edit in pijul/src/commands/apply.rs at line 79
    [3.1107]
    [3.1146]
    let mut touched_files = Vec::with_capacity(touched.len());
  • replacement in pijul/src/commands/apply.rs at line 81
    [3.1173][3.1173:1293]()
    let (path, _) =
    libpijul::fs::find_path(&repo.changes, &txn, &channel.borrow(), false, i)?;
    [3.1173]
    [3.1293]
    if let Some((path, _)) =
    libpijul::fs::find_path(&repo.changes, &txn, &channel.borrow(), false, i)?
    {
    touched_files.push(path)
    } else {
    touched_files.clear();
    break;
    }
    }
    for path in touched_files.iter() {
  • edit in pijul/src/commands/apply.rs at line 100
    [3.1560]
    [3.196314]
    if !touched_files.is_empty() {
    txn.output_repository_no_pending(
    &mut repo.working_copy,
    &repo.changes,
    &mut channel,
    "",
    true,
    None,
    )?;
    }
  • replacement in libpijul/src/pristine/mod.rs at line 1879
    [3.489][3.77261:77352]()
    let (path, _) = crate::fs::find_path(changes, txn, channel, true, file_).unwrap();
    [3.489]
    [3.590]
    let (path, _) = crate::fs::find_path(changes, txn, channel, true, file_).unwrap().unwrap();
  • replacement in libpijul/src/lib.rs at line 555
    [2.128217][3.98460:98541](),[3.731981][3.98460:98541]()
    ) -> Result<(String, bool), output::FileError<C::Error, Self::GraphError>> {
    [2.128217]
    [3.732030]
    ) -> Result<Option<(String, bool)>, output::FileError<C::Error, Self::GraphError>> {
  • replacement in libpijul/src/lib.rs at line 568
    [3.732453][3.98631:98712]()
    ) -> Result<(String, bool), output::FileError<C::Error, Self::GraphError>> {
    [3.732453]
    [3.732502]
    ) -> Result<Option<(String, bool)>, output::FileError<C::Error, Self::GraphError>> {
  • replacement in libpijul/src/fs.rs at line 836
    [3.761102][3.113877:113958]()
    ) -> Result<(String, bool), crate::output::FileError<C::Error, T::GraphError>> {
    [3.761102]
    [3.761147]
    ) -> Result<Option<(String, bool)>, crate::output::FileError<C::Error, T::GraphError>> {
  • replacement in libpijul/src/fs.rs at line 846
    [3.761463][3.6158:6237]()
    let inode_vertex = txn.find_block_end(txn.graph(channel), v).unwrap();
    [3.761463]
    [2.133097]
    let inode_vertex = match txn.find_block_end(txn.graph(channel), v) {
    Ok(block) => block,
    Err(BlockError::Block { block, .. }) => {
    debug!("block not found {:?}", block);
    assert!(path.is_empty());
    return Ok(None)
    },
    Err(BlockError::Txn(t)) => return Err(crate::output::FileError::Txn(t)),
    };
  • replacement in libpijul/src/fs.rs at line 910
    [3.763251][3.763251:763287]()
    Ok((path.join("/"), all_alive))
    [3.763251]
    [3.628]
    Ok(Some((path.join("/"), all_alive)))