diff --git a/Cargo.lock b/Cargo.lock index b05360cc0..eb1b8f6a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,12 +57,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "arc-swap" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" - [[package]] name = "arrayref" version = "0.3.6" @@ -208,12 +202,6 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -[[package]] -name = "bytes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16" - [[package]] name = "cc" version = "1.0.60" @@ -276,15 +264,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - [[package]] name = "color_quant" version = "1.1.0" @@ -535,101 +514,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "futures" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95314d38584ffbfda215621d723e0a3906f032e03ae5551e650058dac83d4797" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0448174b01148032eed37ac4aed28963aaaa8cfa93569a08e5b479bbc6c2c151" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18eaa56102984bed2c88ea39026cff3ce3b4c7f508ca970cedf2450ea10d4e46" - -[[package]] -name = "futures-executor" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f8e0c9258abaea85e78ebdda17ef9666d390e987f006be6080dfe354b708cb" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1798854a4727ff944a7b12aa999f58ce7aa81db80d2dfaaf2ba06f065ddd2b" - -[[package]] -name = "futures-macro" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36fccf3fc58563b4a14d265027c627c3b665d7fed489427e88e7cc929559efe" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3ca3f17d6e8804ae5d3df7a7d35b2b3a6fe89dac84b31872720fc3060a0b11" - -[[package]] -name = "futures-task" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d502af37186c4fef99453df03e374683f8a1eec9dcc1e66b3b82dc8278ce3c" -dependencies = [ - "once_cell", -] - -[[package]] -name = "futures-util" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abcb44342f62e6f3e8ac427b8aa815f724fd705dfad060b18ac7866c15bb8e34" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project", - "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", -] - [[package]] name = "generic-array" version = "0.12.3" @@ -825,15 +709,6 @@ dependencies = [ "tiff", ] -[[package]] -name = "instant" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" -dependencies = [ - "cfg-if", -] - [[package]] name = "itertools" version = "0.9.0" @@ -913,15 +788,6 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "lock_api" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" -dependencies = [ - "scopeguard", -] - [[package]] name = "log" version = "0.4.11" @@ -993,44 +859,12 @@ dependencies = [ "autocfg", ] -[[package]] -name = "mio" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8962c171f57fcfffa53f4df1bb15ec4c8cf26a7569459c9ceb62d94aab0d9584" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "miow" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" -dependencies = [ - "socket2", - "winapi", -] - [[package]] name = "more-asserts" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" -[[package]] -name = "ntapi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" -dependencies = [ - "winapi", -] - [[package]] name = "num-integer" version = "0.1.43" @@ -1106,7 +940,6 @@ dependencies = [ "color_quant", "colored", "error-chain", - "futures", "git2", "image", "lazy_static", @@ -1116,7 +949,6 @@ dependencies = [ "regex", "strum", "tokei", - "tokio", ] [[package]] @@ -1131,19 +963,8 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", -] - -[[package]] -name = "parking_lot" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" -dependencies = [ - "instant", - "lock_api 0.4.1", - "parking_lot_core 0.8.0", + "lock_api", + "parking_lot_core", ] [[package]] @@ -1153,22 +974,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ "cfg-if", - "cloudabi 0.0.3", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if", - "cloudabi 0.1.0", - "instant", + "cloudabi", "libc", "redox_syscall", "smallvec", @@ -1239,38 +1045,6 @@ dependencies = [ "sha-1", ] -[[package]] -name = "pin-project" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee41d838744f60d959d7074e3afb6b35c7456d0f61cad38a24e35e6553f73841" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a4ffa594b66bff340084d4081df649a7dc049ac8d7fc458d8e628bfbbb2f86" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e555d9e657502182ac97b539fb3dae8b79cda19e3e4f8ffb5e8de4f18df93c95" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "pkg-config" version = "0.3.18" @@ -1301,12 +1075,6 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" -[[package]] -name = "proc-macro-nested" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" - [[package]] name = "proc-macro2" version = "1.0.24" @@ -1541,22 +1309,6 @@ dependencies = [ "opaque-debug", ] -[[package]] -name = "signal-hook-registry" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035" -dependencies = [ - "arc-swap", - "libc", -] - -[[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" - [[package]] name = "slug" version = "0.1.4" @@ -1572,18 +1324,6 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" -[[package]] -name = "socket2" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "winapi", -] - [[package]] name = "strsim" version = "0.8.0" @@ -1738,7 +1478,7 @@ dependencies = [ "ignore", "log", "once_cell", - "parking_lot 0.10.2", + "parking_lot", "rayon", "regex", "serde", @@ -1748,39 +1488,6 @@ dependencies = [ "toml", ] -[[package]] -name = "tokio" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ca08accbcb46f11fd8d2d1c6158c348b7888009a1f39260bcad66f6a454250" -dependencies = [ - "autocfg", - "bytes", - "futures-core", - "lazy_static", - "libc", - "memchr", - "mio", - "num_cpus", - "parking_lot 0.11.0", - "pin-project-lite", - "signal-hook-registry", - "slab", - "tokio-macros", - "winapi", -] - -[[package]] -name = "tokio-macros" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48caa7b66c7a6ec943edf78d21a594fbeb24e536c781da67d5c32edec54103f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "toml" version = "0.5.6" diff --git a/Cargo.toml b/Cargo.toml index ee3ec781a..f92265b46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,8 +29,6 @@ clap = "2.33.3" strum = { version = "0.19.5", features = ["derive"] } image = "0.23.11" regex = "1" -futures = "0.3.7" -tokio = { version = "0.3.3", features = ["full"] } error-chain = "0.12" [target.'cfg(windows)'.dependencies] diff --git a/src/onefetch/info.rs b/src/onefetch/info.rs index 4567fb34c..8eebeac58 100644 --- a/src/onefetch/info.rs +++ b/src/onefetch/info.rs @@ -6,7 +6,7 @@ use { colored::{Color, ColoredString, Colorize}, git2::Repository, regex::Regex, - tokio::process::Command, + std::process::Command, }; pub struct Info { @@ -201,31 +201,19 @@ impl std::fmt::Display for Info { } impl Info { - #[tokio::main] - pub async fn new(config: Cli) -> Result { + pub fn new(config: Cli) -> Result { let repo = Repository::discover(&config.path) .chain_err(|| "Could not find a valid git repo on the current path")?; let workdir = repo.workdir().chain_err(|| "Unable to run onefetch on bare git repo")?; let workdir_str = workdir.to_str().unwrap(); let (languages_stats, number_of_lines) = Language::get_language_statistics(workdir_str, &config.excluded)?; - - let ( - git_history, - (number_of_tags, number_of_branches), - (git_v, git_user), - version, - pending, - repo_size, - ) = futures::join!( - Info::get_git_history(workdir_str, config.no_merges), - Info::get_number_of_tags_branches(workdir_str), - Info::get_git_version_and_username(workdir_str), - Info::get_version(workdir_str), - Info::get_pending_changes(workdir_str), - Info::get_packed_size(workdir_str) - ); - + let git_history = Info::get_git_history(workdir_str, config.no_merges); + let (number_of_tags, number_of_branches) = Info::get_number_of_tags_branches(workdir_str); + let (git_v, git_user) = Info::get_git_version_and_username(workdir_str); + let version = Info::get_version(workdir_str); + let pending = Info::get_pending_changes(workdir_str); + let repo_size = Info::get_packed_size(workdir_str); let (repository_name, repository_url) = Info::get_repo_name_and_url(&repo); let current_commit_info = Info::get_current_commit_info(&repo); let creation_date = Info::get_creation_date(&git_history); @@ -267,7 +255,7 @@ impl Info { }) } - async fn get_git_history(dir: &str, no_merges: bool) -> Vec { + fn get_git_history(dir: &str, no_merges: bool) -> Vec { let mut args = vec!["-C", dir, "log"]; if no_merges { args.push("--no-merges"); @@ -275,18 +263,17 @@ impl Info { args.push("--pretty=%cr\t%ae\t%an"); - let output = Command::new("git").args(args).output().await.expect("Failed to execute git."); + let output = Command::new("git").args(args).output().expect("Failed to execute git."); let output = String::from_utf8_lossy(&output.stdout); output.lines().map(|x| x.to_string()).collect::>() } - async fn get_number_of_tags_branches(dir: &str) -> (usize, usize) { + fn get_number_of_tags_branches(dir: &str) -> (usize, usize) { let tags = { let output = Command::new("git") .args(vec!["-C", dir, "tag"]) .output() - .await .expect("Failed to execute git."); let tags = String::from_utf8_lossy(&output.stdout); @@ -298,7 +285,6 @@ impl Info { let output = Command::new("git") .args(vec!["-C", dir, "branch", "-r"]) .output() - .await .expect("Failed to execute git."); let branches = String::from_utf8_lossy(&output.stdout); @@ -401,9 +387,9 @@ impl Info { authors } - async fn get_git_version_and_username(dir: &str) -> (String, String) { + fn get_git_version_and_username(dir: &str) -> (String, String) { let version = - Command::new("git").arg("--version").output().await.expect("Failed to execute git."); + Command::new("git").arg("--version").output().expect("Failed to execute git."); let version = String::from_utf8_lossy(&version.stdout).replace('\n', ""); let username = Command::new("git") @@ -413,13 +399,12 @@ impl Info { .arg("--get") .arg("user.name") .output() - .await .expect("Failed to execute git."); let username = String::from_utf8_lossy(&username.stdout).replace('\n', ""); (version, username) } - async fn get_version(dir: &str) -> Result { + fn get_version(dir: &str) -> Result { let output = Command::new("git") .arg("-C") .arg(dir) @@ -427,7 +412,6 @@ impl Info { .arg("--abbrev=0") .arg("--tags") .output() - .await .expect("Failed to execute git."); let output = String::from_utf8_lossy(&output.stdout); @@ -444,14 +428,13 @@ impl Info { number_of_commits.to_string() } - async fn get_pending_changes(dir: &str) -> Result { + fn get_pending_changes(dir: &str) -> Result { let output = Command::new("git") .arg("-C") .arg(dir) .arg("status") .arg("--porcelain") .output() - .await .expect("Failed to execute git."); let output = String::from_utf8_lossy(&output.stdout); @@ -493,14 +476,13 @@ impl Info { } } - async fn get_packed_size(dir: &str) -> Result { + fn get_packed_size(dir: &str) -> Result { let output = Command::new("git") .arg("-C") .arg(dir) .arg("count-objects") .arg("-vH") .output() - .await .expect("Failed to execute git."); let output = String::from_utf8_lossy(&output.stdout); @@ -517,7 +499,6 @@ impl Info { .arg(dir) .arg("ls-files") .output() - .await .expect("Failed to execute git."); // To check if command executed successfully or not let error = &output.stderr;