Skip to content

Commit

Permalink
avoid verbose logs between lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederick888 committed Oct 6, 2017
1 parent e67a5b3 commit 2918e18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/cargo_ops/elaborate_workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PackageId> {
if let Some(ref root_name) = options.flag_root {
if let Ok(workspace_root) = self.workspace.current() {
Expand All @@ -92,6 +93,7 @@ impl<'ela> ElaborateWorkspace<'ela> {
}
}

/// Find a member based on member name
fn find_member(&self, member: &PackageId) -> CargoResult<PackageId> {
for m in self.workspace.members() {
// members with the same name in a workspace is not allowed
Expand Down Expand Up @@ -252,11 +254,9 @@ impl<'ela> ElaborateWorkspace<'ela> {
pub fn print_list(
&self,
options: &Options,
config: &Config,
root: &PackageId,
preceding_line: bool,
) -> CargoResult<i32> {
verbose!(config, "Printing...", "list format");
let mut lines = vec![];
let root_parent = if self.virtual_manifest || root == self.workspace.current()?.package_id()
{
Expand All @@ -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!");
Expand Down
1 change: 1 addition & 0 deletions src/cargo_ops/temp_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ impl<'tmp> TempProject<'tmp> {
}
}

/// Paths of all manifest files in current workspace
fn manifest_paths(elab: &ElaborateWorkspace) -> CargoResult<Vec<PathBuf>> {
let mut visited: HashSet<PackageId> = HashSet::new();
let mut manifest_paths = vec![];
Expand Down
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ pub fn execute(options: Options, config: &Config) -> CargoResult<i32> {
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,
Expand All @@ -291,16 +291,18 @@ pub fn execute(options: Options, config: &Config) -> CargoResult<i32> {
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)
}
}
Expand Down

0 comments on commit 2918e18

Please sign in to comment.