MUCH faster `pijul add -r`
[?]
Dec 11, 2020, 5:51 PM
OJZWJUF2TCGZ7RFVY6FPKBS5P3C4BGHZDPVH775OHVNVFMJICKNQCDependencies
- [2]
2K7JLB4ZNo pager on Windows - [3]
VO5OQW4WRemoving anyhow in libpijul - [4]
4OCC6D42Recursive add - [5]
R3H7D42UDebugging `pijul git`: proper error reporting - [6]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [7]
LCERQSWMCleanup - [*]
Q45QHPO4Feedback on network stuff
Change contents
- edit in pijul/src/commands/record.rs at line 189
num_cpus::get(), - edit in pijul/src/commands/git.rs at line 697
let num_cpus = num_cpus::get(); - replacement in pijul/src/commands/git.rs at line 699
let result = working_copy.record_prefix(txn, channel, changes, &mut state, repo_path, p);let result =working_copy.record_prefix(txn, channel, changes, &mut state, repo_path, p, num_cpus); - edit in pijul/src/commands/file_operations.rs at line 101
let threads = num_cpus::get(); - replacement in pijul/src/commands/file_operations.rs at line 112
.add_prefix_rec(&mut txn, &repo.path, &full, &prefix)?.add_prefix_rec(&mut txn, &repo.path, &full, &prefix, threads)? - edit in pijul/src/commands/diff.rs at line 60
num_cpus::get(), - edit in pijul/Cargo.toml at line 78[9.2859][2.309]
num_cpus = "1.13" - edit in libpijul/src/working_copy/filesystem.rs at line 95
threads: usize, - replacement in libpijul/src/working_copy/filesystem.rs at line 98
self.record_prefix(txn, channel, changes, state, repo_path, prefix.as_ref())?self.record_prefix(txn,channel,changes,state,repo_path,prefix.as_ref(),threads,)? - replacement in libpijul/src/working_copy/filesystem.rs at line 109
self.record_prefix(txn, channel, changes, state, repo_path, Path::new(""))?self.record_prefix(txn,channel,changes,state,repo_path,Path::new(""),threads,)? - edit in libpijul/src/working_copy/filesystem.rs at line 128
threads: usize, - replacement in libpijul/src/working_copy/filesystem.rs at line 136
if let Ok(meta) = meta {if meta.is_dir() {let mut walk = WalkBuilder::new(&full);walk.standard_filters(true);let walk = walk.build();for entry in walk {let entry = entry?;let p = entry.path();if let Some(p) = p.file_name() {if let Some(p) = p.to_str() {if p.ends_with("~") || (p.starts_with("#") && p.ends_with("#")) {continue;let (sender, receiver) = std::sync::mpsc::sync_channel(100);let full = full.to_path_buf();let t = std::thread::spawn(move || -> Result<(), AddError<T::Error>> {if let Ok(meta) = meta {if meta.is_dir() {let mut walk = WalkBuilder::new(&full);walk.standard_filters(true);walk.threads(threads - 1);walk.build_parallel().run(|| {Box::new(|entry| {let entry: ignore::DirEntry = if let Ok(entry) = entry {entry} else {return ignore::WalkState::Quit;};let p = entry.path();if let Some(p) = p.file_name() {if let Some(p) = p.to_str() {if p.ends_with("~") || (p.starts_with("#") && p.ends_with("#")){return ignore::WalkState::Skip;}}}debug!("entry path = {:?} {:?}", entry.path(), repo_path_);if let Ok(path) = entry.path().strip_prefix(&repo_path_) {let is_dir = entry.file_type().unwrap().is_dir();sender.send((path.to_path_buf(), is_dir)).unwrap();} else {debug!("entry = {:?}", entry.path()); - replacement in libpijul/src/working_copy/filesystem.rs at line 167
}}debug!("entry path = {:?} {:?}", entry.path(), repo_path);if let Ok(path) = entry.path().strip_prefix(&repo_path_) {let path_str = path.to_str().unwrap();if !txn.is_tracked(&path_str) {info!("Adding {:?}", path);txn.add(path_str, entry.file_type().unwrap().is_dir())?} else {debug!("already tracked {:?}", path_str)}} else {debug!("entry = {:?}", entry.path());}ignore::WalkState::Continue})})} else if let Ok(path) = full.strip_prefix(&repo_path_) {sender.send((path.to_path_buf(), false)).unwrap(); - edit in libpijul/src/working_copy/filesystem.rs at line 173
} else if let Ok(path) = full.strip_prefix(&repo_path_) {let path_str = path.to_str().unwrap();if !txn.is_tracked(&path_str) {info!("Adding file {:?}", path);txn.add(path_str, false)?} - edit in libpijul/src/working_copy/filesystem.rs at line 174
Ok(())});while let Ok((path, is_dir)) = receiver.recv() {info!("Adding {:?}", path);let path_str = path.to_str().unwrap();txn.add(path_str, is_dir)?}if let Ok(t) = t.join() {t? - edit in libpijul/src/working_copy/filesystem.rs at line 200
threads: usize, - replacement in libpijul/src/working_copy/filesystem.rs at line 203
self.add_prefix_rec(txn, repo_path, &full, &prefix)?;self.add_prefix_rec(txn, repo_path, &full, &prefix, threads)?; - edit in libpijul/src/pristine/path_id.rs at line 1
// org id iBTHhIzBVluJ4gTIZXlBR1WgC/C6Zw4cKuVCh++X60Y= - edit in libpijul/src/pristine/inode.rs at line 1
// org id husqv+oHDFDeBrRtm5ymelT1H84bAvU87dV7ig64UFo= - replacement in libpijul/src/fs.rs at line 74
fileid.basename = SmallString::from_str(c);fileid.basename.clone_from_str(c); - replacement in libpijul/src/fs.rs at line 82
id.cmp(&fileid)id > fileid - edit in libpijul/src/fs.rs at line 89
if !found {fileid.parent_inode = inode;} - edit in libpijul/src/fs.rs at line 90
fileid.parent_inode = inode;break; - replacement in libpijul/src/fs.rs at line 217
current_inode = make_new_child(txn, current_inode, c, true, None)?current_inode = make_new_child(txn, current_inode, c, true, None)?;