From 2918e185bbd671fd0e8750c69723d0fc0d23829d Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Wed, 27 Sep 2017 02:07:31 +1000 Subject: [PATCH] avoid verbose logs between lists --- src/cargo_ops/elaborate_workspace.rs | 5 ++--- src/cargo_ops/temp_project.rs | 1 + src/main.rs | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cargo_ops/elaborate_workspace.rs b/src/cargo_ops/elaborate_workspace.rs index 4a9bc8c..ea59d92 100644 --- a/src/cargo_ops/elaborate_workspace.rs +++ b/src/cargo_ops/elaborate_workspace.rs @@ -67,6 +67,7 @@ impl<'ela> ElaborateWorkspace<'ela> { }) } + /// Determine root package based on current workspace and CLI options pub fn determine_root(&self, options: &Options) -> CargoResult { if let Some(ref root_name) = options.flag_root { if let Ok(workspace_root) = self.workspace.current() { @@ -92,6 +93,7 @@ impl<'ela> ElaborateWorkspace<'ela> { } } + /// Find a member based on member name fn find_member(&self, member: &PackageId) -> CargoResult { for m in self.workspace.members() { // members with the same name in a workspace is not allowed @@ -252,11 +254,9 @@ impl<'ela> ElaborateWorkspace<'ela> { pub fn print_list( &self, options: &Options, - config: &Config, root: &PackageId, preceding_line: bool, ) -> CargoResult { - verbose!(config, "Printing...", "list format"); let mut lines = vec![]; let root_parent = if self.virtual_manifest || root == self.workspace.current()?.package_id() { @@ -280,7 +280,6 @@ impl<'ela> ElaborateWorkspace<'ela> { lines.dedup(); let lines_len = lines.len(); - verbose!(config, "Printing...", "with tab writer"); if lines.is_empty() { if !self.virtual_manifest { println!("All dependencies are up to date, yay!"); diff --git a/src/cargo_ops/temp_project.rs b/src/cargo_ops/temp_project.rs index 25374f9..948af17 100644 --- a/src/cargo_ops/temp_project.rs +++ b/src/cargo_ops/temp_project.rs @@ -330,6 +330,7 @@ impl<'tmp> TempProject<'tmp> { } } +/// Paths of all manifest files in current workspace fn manifest_paths(elab: &ElaborateWorkspace) -> CargoResult> { let mut visited: HashSet = HashSet::new(); let mut manifest_paths = vec![]; diff --git a/src/main.rs b/src/main.rs index 4c6ddfb..b819125 100644 --- a/src/main.rs +++ b/src/main.rs @@ -280,9 +280,9 @@ pub fn execute(options: Options, config: &Config) -> CargoResult { let ela_latest = ElaborateWorkspace::from_workspace(latest_workspace.as_ref().unwrap(), &options)?; - verbose!(config, "Resolving...", "package status"); if ela_curr.virtual_manifest { let mut sum = 0; + verbose!(config, "Printing...", "Package status in list format"); for member in ela_curr.workspace.members() { ela_curr.resolve_status( &ela_compat, @@ -291,16 +291,18 @@ pub fn execute(options: Options, config: &Config) -> CargoResult { config, member.package_id(), )?; - sum += ela_curr.print_list(&options, config, member.package_id(), sum > 0)?; + sum += ela_curr.print_list(&options, member.package_id(), sum > 0)?; } if sum == 0 { println!("All dependencies are up to date, yay!"); } Ok(sum) } else { + verbose!(config, "Resolving...", "package status"); let root = ela_curr.determine_root(&options)?; ela_curr.resolve_status(&ela_compat, &ela_latest, &options, config, &root)?; - let count = ela_curr.print_list(&options, config, &root, false)?; + verbose!(config, "Printing...", "list format"); + let count = ela_curr.print_list(&options, &root, false)?; Ok(count) } }