export only the files touched by each change

andybalholm
Apr 18, 2023, 6:55 PM
KPGRBRHS3HGVO3FTJQ33GATP75TO4CE6DL567YZTXTWGLELRZYKQC

Dependencies

Change contents

  • edit in src/repo.rs at line 1
    [7.32]
    [8.0]
    use std::collections::BTreeSet;
  • edit in src/repo.rs at line 24
    [4.168]
    [4.168]
    use libpijul::DepsTxnT;
    use libpijul::GraphTxnT;
    use libpijul::Hash;
  • replacement in src/repo.rs at line 248
    [4.1942][3.0:69]()
    pub fn get_files(&mut self) -> Result<FileSet, Box<dyn Error>> {
    [4.1942]
    [4.2013]
    pub fn get_files(&mut self, change: Hash) -> Result<FileSet, Box<dyn Error>> {
  • replacement in src/repo.rs at line 252
    [4.2104][4.2104:2160](),[4.2160][4.2160:2177](),[4.2177][4.2177:2354]()
    libpijul::output::output_repository_no_pending(
    &fs,
    &self.change_store,
    &self.txn,
    &self.channel,
    "",
    false,
    None,
    1,
    0,
    )?;
    [4.2104]
    [4.2354]
    let mut touched_paths = BTreeSet::new();
    let txn = self.txn.read();
    if let Some(int) = txn.get_internal(&change.into())? {
    for inode in txn.iter_rev_touched(int)? {
    let (int_, inode) = inode?;
    if int_ < int {
    continue;
    } else if int_ > int {
    break;
    }
    if let Some((path, _)) = libpijul::fs::find_path(
    &self.change_store,
    &*txn,
    &*self.channel.read(),
    false,
    *inode,
    )? {
    touched_paths.insert(path);
    } else {
    touched_paths.clear();
    break;
    }
    }
    }
    if touched_paths.is_empty() {
    touched_paths.insert(String::from(""));
    }
    std::mem::drop(txn);
  • edit in src/repo.rs at line 282
    [4.2355]
    [3.129]
    let mut last: Option<&str> = None;
    for path in touched_paths.iter() {
    match last {
    Some(last_path) => {
    // If `last_path` is a prefix (in the path sense) of `path`, skip.
    if last_path.len() < path.len() {
    let (pre_last, post_last) = path.split_at(last_path.len());
    if pre_last == last_path && post_last.starts_with("/") {
    continue;
    }
    }
    }
    _ => (),
    }
    libpijul::output::output_repository_no_pending(
    &fs,
    &self.change_store,
    &self.txn,
    &self.channel,
    path,
    true,
    None,
    1,
    0,
    )?;
    last = Some(path);
    }
  • replacement in src/main.rs at line 43
    [2.303][2.303:357]()
    let files = sandbox.get_files().unwrap();
    [2.303]
    [2.357]
    let files = sandbox.get_files(changes[i].hash).unwrap();