better verbosity

This commit is contained in:
Cyryl Płotnicki 2019-09-07 10:59:44 +01:00
parent 6ed47937ee
commit 5643ea3ee1
4 changed files with 1 additions and 11 deletions

View file

@ -62,7 +62,6 @@ impl Index {
} }
pub fn remember(&mut self, item: RepositoryItem) { pub fn remember(&mut self, item: RepositoryItem) {
println!("remembering {}", item);
self.items.push(item.into()); self.items.push(item.into());
} }

View file

@ -67,7 +67,6 @@ impl<'a> Repository<'a> {
} }
if source_path.is_file() { if source_path.is_file() {
println!("storing {} as {}", source_path.display(), destination_path.display());
fs::create_dir_all(destination_path.parent().unwrap())?; fs::create_dir_all(destination_path.parent().unwrap())?;
let version = Repository::calculate_version(source_path)?; let version = Repository::calculate_version(source_path)?;
fs::copy(source_path, destination_path)?; fs::copy(source_path, destination_path)?;
@ -95,12 +94,6 @@ impl<'a> Repository<'a> {
} }
pub fn item_by_source_path(&self, path: &Path) -> Result<Option<RepositoryItem>, BakareError> { pub fn item_by_source_path(&self, path: &Path) -> Result<Option<RepositoryItem>, BakareError> {
println!(
"trying to find {} in a repo [{}] of {} items",
path.display(),
self.path.display(),
self.index.len()
);
if !path.is_absolute() { if !path.is_absolute() {
return Err(BakareError::RepositoryPathNotAbsolute); return Err(BakareError::RepositoryPathNotAbsolute);
} }

View file

@ -32,13 +32,11 @@ impl RepositoryItem {
} }
let parent = target_path.parent().unwrap(); let parent = target_path.parent().unwrap();
if !parent.exists() { if !parent.exists() {
println!("Creating {}", parent.display());
fs::create_dir_all(parent)?; fs::create_dir_all(parent)?;
} }
if !self.absolute_path.exists() { if !self.absolute_path.exists() {
return Err(BakareError::CorruptedRepoNoFile); return Err(BakareError::CorruptedRepoNoFile);
} }
println!("Saving {} to {}", self.absolute_path.display(), target_path.display());
fs::copy(&self.absolute_path, &target_path)?; fs::copy(&self.absolute_path, &target_path)?;
Ok(()) Ok(())

View file

@ -137,7 +137,7 @@ fn assert_directory_trees_have_same_contents(left: &Path, right: &Path) -> Resul
let mut br = vec![]; let mut br = vec![];
fl.read_to_end(&mut bl)?; fl.read_to_end(&mut bl)?;
fr.read_to_end(&mut br)?; fr.read_to_end(&mut br)?;
assert_eq!(bl, bl); assert_eq!(bl, br);
} }
Ok(()) Ok(())
} }