diff --git a/Cargo.lock b/Cargo.lock index 0618958..a4b1510 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -777,18 +777,18 @@ checksum = "767eb9f07d4a5ebcb39bbf2d452058a93c011373abf6832e24194a1c3f004794" [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -1069,9 +1069,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "2.0.18" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", diff --git a/src/commands/add.rs b/src/commands/add.rs index 11840e4..2c4c72f 100644 --- a/src/commands/add.rs +++ b/src/commands/add.rs @@ -18,7 +18,6 @@ pub struct AddArgs<'a> { // todo match deleted files // todo match weird reg expression -// todo -A == . pub fn add(args: AddArgs) { // write all modification in the index if args.all { @@ -104,7 +103,6 @@ fn add_folder_content(path: PathBuf, added_files: &mut Vec) { } } } - } fn write_all() { @@ -114,6 +112,6 @@ fn write_all() { .create(true) .open(index::path()).expect("Cannot open index file"); for obj in objs { - writeln!(index_file, "{}", path_buf_to_string(obj.path.clone())); + let _ = writeln!(index_file, "{}", path_buf_to_string(obj.path.clone())); } } diff --git a/src/commands/clone.rs b/src/commands/clone.rs index 1bda8cf..02b9374 100644 --- a/src/commands/clone.rs +++ b/src/commands/clone.rs @@ -91,10 +91,10 @@ pub fn clone(args: CloneArgs) { } } - let downloader = Downloader::new() + Downloader::new() .set_api_props(api_props.clone()) .set_files(files) - //.should_log() + .should_log() .download(ref_path.clone(), Some(&save_blob)); } diff --git a/src/commands/pull.rs b/src/commands/pull.rs index 53849c0..3df3a01 100644 --- a/src/commands/pull.rs +++ b/src/commands/pull.rs @@ -35,7 +35,7 @@ pub fn pull() { } } - let downloader = Downloader::new() + Downloader::new() .set_api_props(get_api_props()) .set_files(files) .should_log() diff --git a/src/commands/push/push_factory.rs b/src/commands/push/push_factory.rs index 3c0bd2a..32cbc9a 100644 --- a/src/commands/push/push_factory.rs +++ b/src/commands/push/push_factory.rs @@ -96,7 +96,6 @@ impl PushFactory { State::Moved => Box::new(Moved { obj }), State::Copied => Box::new(Copied { obj }), State::Default => todo!(), - _ => todo!(), } } diff --git a/src/commands/remote_diff.rs b/src/commands/remote_diff.rs index aa8376d..5c8cebf 100644 --- a/src/commands/remote_diff.rs +++ b/src/commands/remote_diff.rs @@ -12,8 +12,6 @@ pub fn remote_diff() { .unwrap() .strip_prefix(path::repo_root()).unwrap().to_path_buf(); let (folders, files) = get_diff(relative_p); - dbg!(files); - return; for folder in folders { println!("should pull {}", folder.clone().relative_s.unwrap()); diff --git a/src/commands/status.rs b/src/commands/status.rs index 0b64bf1..9c71b8f 100644 --- a/src/commands/status.rs +++ b/src/commands/status.rs @@ -1,6 +1,6 @@ use std::fs::File; use std::path::PathBuf; -use std::io::{self, Lines, BufReader}; +use std::io::{Lines, BufReader}; use std::collections::HashMap; use crypto::digest::Digest; use crypto::sha1::Sha1; diff --git a/src/services/copy.rs b/src/services/copy.rs index 1acfe0e..541b9f0 100644 --- a/src/services/copy.rs +++ b/src/services/copy.rs @@ -41,7 +41,7 @@ impl Copy { self.api_builder.send().await } - pub fn overwrite(&mut self, overwrite: bool) -> &mut Copy { + pub fn _overwrite(&mut self, overwrite: bool) -> &mut Copy { self.api_builder.set_header("Overwrite", HeaderValue::from_str({ if overwrite { "T" } else { "F" } }).unwrap()); diff --git a/src/services/downloader.rs b/src/services/downloader.rs index 66987c3..e9a6266 100644 --- a/src/services/downloader.rs +++ b/src/services/downloader.rs @@ -42,7 +42,7 @@ impl Downloader { self } - pub fn add_file(&mut self, file: ObjProps) -> &mut Downloader { + pub fn _add_file(&mut self, file: ObjProps) -> &mut Downloader { self.files.push(file); self } diff --git a/src/services/move.rs b/src/services/move.rs index 38d3bde..b91b64f 100644 --- a/src/services/move.rs +++ b/src/services/move.rs @@ -41,7 +41,7 @@ impl Move { self.api_builder.send().await } - pub fn overwrite(&mut self, overwrite: bool) -> &mut Move { + pub fn _overwrite(&mut self, overwrite: bool) -> &mut Move { self.api_builder.set_header("Overwrite", HeaderValue::from_str({ if overwrite { "T" } else { "F" } }).unwrap()); diff --git a/src/store/object.rs b/src/store/object.rs index 4d2a422..3229309 100644 --- a/src/store/object.rs +++ b/src/store/object.rs @@ -223,32 +223,3 @@ fn create_obj(name: String, content: &str) -> io::Result<()> { Ok(()) } -// get the last time a blob synced with remote -pub fn get_timestamp(path_s: String) -> Option { - let mut obj_p = path::objects(); - - let (dir, res) = hash_obj(&path_s); - obj_p.push(dir); - obj_p.push(res); - - match read::read_lines(obj_p) { - Ok(mut reader) => { - match reader.next() { - Some(Ok(line)) => { - let mut data = line.rsplit(' '); - if data.clone().count() >= 2 { - Some(data.nth_back(1).unwrap().parse::().unwrap()) - } else { - None - } - }, - _ => None, - } - }, - Err(err) => { - eprintln!("error reading object: {}", err); - None - }, - } - -} diff --git a/src/store/object/blob.rs b/src/store/object/blob.rs index 523c587..a432248 100644 --- a/src/store/object/blob.rs +++ b/src/store/object/blob.rs @@ -113,7 +113,7 @@ impl Blob { refs_p.push(dir); if !refs_p.exists() { - fs::create_dir_all(refs_p.clone()); + let _ = fs::create_dir_all(refs_p.clone()); } refs_p.push(res); refs_p diff --git a/src/utils/remote.rs b/src/utils/remote.rs index 3345c23..577b78a 100644 --- a/src/utils/remote.rs +++ b/src/utils/remote.rs @@ -1,5 +1,5 @@ use std::path::PathBuf; -use crate::{services::{req_props::{ObjProps, ReqProps}, api::ApiError}, store::object::{blob::Blob, Object}, commands::status::State}; +use crate::{services::{req_props::ObjProps, api::ApiError}, store::object::{blob::Blob, Object}, commands::status::State}; use std::collections::HashMap; use super::{path::{path_buf_to_string, self}, read};