Do not traverse unindexed directories in `pijul diff -su`

pmeunier
Feb 8, 2024, 4:07 PM
J33DKFPM7LLK5V47GXZYJ6LO24VYA77DYHKT4QNPESABETUOVYMQC

Dependencies

  • [2] BKF5KRLH Fixing `pijul diff --untracked`
  • [3] RAS4PCNU "Touch" the channel after `pijul diff` if the diff and the prefixes are both empty
  • [4] TVUSKAR7 Do not canonicalize paths when adding them from an ignore::walk
  • [5] DDJO7X2P Remove dependency on `num_cpus`
  • [6] YGPEHOTE libpijul::fs::add_{file,dir} now return the created Inode
  • [7] NWU66ZIP Untracked files when there are no other changes
  • [8] I24UEJQL Various post-fire fixes
  • [9] 2RXOCWUW Making libpijul deterministic (and getting rid of `rand`)
  • [10] VO5OQW4W Removing anyhow in libpijul
  • [11] 3J6IK4W2 Explicitly adding .pijul is now forbidden
  • [12] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [13] ZDK3GNDB Tag transactions (including a massive refactoring of errors)
  • [14] VYHHOEYH Versions and formatting
  • [15] 3SJ3DJNF Adding a --force option to `pijul add`, to include otherwise ignored files
  • [16] EWZ7VHV4 pijul diff: Do not ignore the --untracked option in presence of --short.
  • [17] HSEYMLO2 Adding an untracked change iterator
  • [18] 5BB266P6 Optional colours in the global config file
  • [19] OJZWJUF2 MUCH faster `pijul add -r`
  • [20] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [21] I52XSRUH Massive cleanup, and simplification
  • [22] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [23] V6J6DTJC Do not compute the entire diff if all we want is --json --untracked
  • [*] 4OCC6D42 Recursive add

Change contents

  • edit in pijul/src/commands/diff.rs at line 47
    [6.42][6.42:76]()
    let txn = txn.read();
  • replacement in pijul/src/commands/diff.rs at line 49
    [6.158][6.158:221]()
    &untracked(&repo, &*txn)?.collect::<Vec<_>>(),
    [6.158]
    [6.221]
    &untracked(&repo, txn.clone())?.collect::<Result<Vec<_>, _>>()?,
  • edit in pijul/src/commands/diff.rs at line 105
    [6.175108][6.0:34]()
    let txn = txn.read();
  • replacement in pijul/src/commands/diff.rs at line 106
    [6.46][6.62:188](),[6.62][6.62:188]()
    for path in untracked(&repo, &*txn)? {
    writeln!(stdout, "U {}", path.to_str().unwrap())?;
    [6.46]
    [6.188]
    for path in untracked(&repo, txn.clone())? {
    writeln!(stdout, "U {}", path?.to_str().unwrap())?;
  • replacement in pijul/src/commands/diff.rs at line 110
    [6.245][6.245:369]()
    for path in untracked(&repo, &*txn)? {
    writeln!(stdout, "{}", path.to_str().unwrap())?;
    [6.245]
    [6.369]
    for path in untracked(&repo, txn.clone())? {
    writeln!(stdout, "{}", path?.to_str().unwrap())?;
  • replacement in pijul/src/commands/diff.rs at line 116
    [6.175145][3.0:70](),[3.70][6.175171:175217](),[6.175171][6.175171:175217](),[6.175217][3.71:126](),[3.126][6.175261:175285](),[6.17573][6.175261:175285](),[6.20408][6.175261:175285](),[6.175261][6.175261:175285]()
    let mut txn_ = txn.write();
    let actions: Vec<_> = rec
    .actions
    .into_iter()
    .map(|rec| rec.globalize(&*txn_).unwrap())
    .collect();
    [6.175145]
    [3.127]
    let actions: Vec<_> = {
    let txn_ = txn.read();
    rec.actions
    .into_iter()
    .map(|rec| rec.globalize(&*txn_).unwrap())
    .collect()
    };
  • replacement in pijul/src/commands/diff.rs at line 130
    [6.175336][3.179:199]()
    &*txn_,
    [6.175336]
    [6.175354]
    &*txn.read(),
  • replacement in pijul/src/commands/diff.rs at line 138
    [6.175496][6.175496:175552](),[6.175552][3.200:249](),[3.249][6.175598:175615](),[6.17634][6.175598:175615](),[6.20679][6.175598:175615](),[6.175598][6.175598:175615](),[6.175615][3.250:325]()
    let (dependencies, extra_known) = if self.tag {
    full_dependencies(&*txn_, &channel)?
    } else {
    dependencies(&*txn_, &*channel.read(), change.changes.iter())?
    [6.175496]
    [6.175679]
    let (dependencies, extra_known) = {
    let txn_ = txn.read();
    if self.tag {
    full_dependencies(&*txn_, &channel)?
    } else {
    dependencies(&*txn_, &*channel.read(), change.changes.iter())?
    }
  • replacement in pijul/src/commands/diff.rs at line 242
    [6.79][3.326:382](),[3.382][6.134:205](),[6.134][6.134:205]()
    for path in untracked(&repo, &*txn_)? {
    writeln!(stdout, "U {}", path.to_str().unwrap())?;
    [6.79]
    [6.205]
    for path in untracked(&repo, txn.clone())? {
    writeln!(stdout, "U {}", path?.to_str().unwrap())?;
  • replacement in pijul/src/commands/diff.rs at line 247
    [6.2054][3.383:435](),[3.435][6.2105:2170](),[6.2105][6.2105:2170]()
    for path in untracked(&repo, &*txn_)? {
    writeln!(stdout, "{}", path.to_str().unwrap())?;
    [6.2054]
    [6.2170]
    for path in untracked(&repo, txn.clone())? {
    writeln!(stdout, "{}", path?.to_str().unwrap())?;
  • replacement in pijul/src/commands/diff.rs at line 268
    [3.536][3.536:631]()
    txn_.touch_channel(&mut *channel.write(), None);
    std::mem::drop(txn_);
    [3.536]
    [3.631]
    {
    let mut txn_ = txn.write();
    txn_.touch_channel(&mut *channel.write(), None);
    }
  • replacement in pijul/src/commands/diff.rs at line 375
    [6.2188][6.2188:2218]()
    fn untracked<'a, T: TxnTExt>(
    [6.2188]
    [6.2218]
    fn untracked<T: TxnTExt + Send + Sync + 'static>(
  • replacement in pijul/src/commands/diff.rs at line 377
    [6.2241][6.2241:2322]()
    txn: &'a T,
    ) -> Result<impl Iterator<Item = PathBuf> + 'a, anyhow::Error> {
    [6.2241]
    [6.2322]
    txn: libpijul::ArcTxn<T>,
    ) -> Result<impl Iterator<Item = Result<PathBuf, std::io::Error>>, anyhow::Error> {
  • edit in pijul/src/commands/diff.rs at line 381
    [5.1767]
    [6.2422]
    let txn_ = txn.clone();
  • replacement in pijul/src/commands/diff.rs at line 384
    [6.2456][6.121:204](),[6.204][6.2532:2603](),[6.2532][6.2532:2603](),[6.2783][6.2783:2820](),[6.2820][2.0:50](),[2.50][6.2871:2993](),[6.2871][6.2871:2993]()
    .iterate_prefix_rec(repo_path.clone(), repo_path.clone(), false, threads)?
    .filter_map(move |x| {
    let (path, _) = x.unwrap();
    use path_slash::PathExt;
    let path_str = path.to_slash_lossy();
    if !txn.is_tracked(&path_str).unwrap() {
    Some(path)
    } else {
    None
    [6.2456]
    [6.2993]
    .iterate_prefix_rec(
    repo_path.clone(),
    repo_path.clone(),
    false,
    threads,
    move |path, _| {
    use path_slash::PathExt;
    let path_str = path.to_slash_lossy();
    log::debug!("untracked {:?}", path_str);
    path_str.is_empty() || txn.read().is_tracked(&path_str).unwrap()
    },
    )?
    .filter_map(move |path| match path {
    Err(e) => Some(Err(e)),
    Ok((path, _)) => {
    use path_slash::PathExt;
    let path_str = path.to_slash_lossy();
    log::debug!("untracked {:?}", path_str);
    if !txn_.read().is_tracked(&path_str).unwrap() {
    Some(Ok(path))
    } else {
    None
    }
  • replacement in libpijul/src/working_copy/filesystem.rs at line 141
    [6.3436][6.3436:3567]()
    } else if let Some(j) = self.join.take() {
    if let Ok(Err(e)) = j.join() {
    return Some(Err(e));
    [6.3436]
    [6.3567]
    } else {
    if let Some(j) = self.join.take() {
    if let Ok(Err(e)) = j.join() {
    return Some(Err(e));
    }
  • replacement in libpijul/src/working_copy/filesystem.rs at line 220
    [6.3672][6.368:461]()
    for p in self.iterate_prefix_rec(repo_path.clone(), full.clone(), force, threads)? {
    [6.3672]
    [6.3758]
    for p in
    self.iterate_prefix_rec(repo_path.clone(), full.clone(), force, threads, |_, _| true)?
    {
  • replacement in libpijul/src/working_copy/filesystem.rs at line 239
    [6.4162][6.4162:4193]()
    pub fn iterate_prefix_rec(
    [6.4162]
    [6.4193]
    pub fn iterate_prefix_rec<F: Fn(&Path, bool) -> bool + Send + Sync + 'static>(
  • edit in libpijul/src/working_copy/filesystem.rs at line 245
    [6.4301]
    [6.4301]
    follow: F,
  • edit in libpijul/src/working_copy/filesystem.rs at line 266
    [6.185]
    [6.4452]
    let follow = std::sync::Arc::new(follow);
  • edit in libpijul/src/working_copy/filesystem.rs at line 268
    [6.4527]
    [6.186]
    let follow = follow.clone();
  • replacement in libpijul/src/working_copy/filesystem.rs at line 279
    [6.1894][6.576:662](),[6.576][6.576:662]()
    walk.build_parallel().run(|| {
    Box::new(|entry| {
    [6.1894]
    [6.662]
    walk.build_parallel().run(move || {
    let repo_path = repo_path.clone();
    let sender = sender.clone();
    let follow = follow.clone();
    Box::new(move |entry| {
  • edit in libpijul/src/working_copy/filesystem.rs at line 303
    [25.2707]
    [4.309]
    if !follow(path, is_dir) {
    return ignore::WalkState::Skip;
    }