Display the dry run preview: per-view manifest sync plans.
(
&self,
repo: &Repository,
remote_name: &str,
remote_url: &str,
syncs: &[ViewSync],
)
| 413 | |
| 414 | /// Display the dry run preview: per-view manifest sync plans. |
| 415 | fn display_dry_run( |
| 416 | &self, |
| 417 | repo: &Repository, |
| 418 | remote_name: &str, |
| 419 | remote_url: &str, |
| 420 | syncs: &[ViewSync], |
| 421 | ) -> CliResult<()> { |
| 422 | let active: Vec<&ViewSync> = syncs.iter().filter(|s| !s.plan.is_noop()).collect(); |
| 423 | |
| 424 | if active.is_empty() { |
| 425 | print_success("Already up to date - nothing to push"); |
| 426 | return Ok(()); |
| 427 | } |
| 428 | |
| 429 | println!( |
| 430 | "Would sync {} to {}:", |
| 431 | format_count(active.len(), "view"), |
| 432 | remote_name |
| 433 | ); |
| 434 | print_blank(); |
| 435 | |
| 436 | for sync in &active { |
| 437 | let scope = sync.manifest.scope.to_string(); |
| 438 | let parent = sync |
| 439 | .manifest |
| 440 | .parent |
| 441 | .as_deref() |
| 442 | .map(|p| format!(", parent {}", p)) |
| 443 | .unwrap_or_default(); |
| 444 | println!( |
| 445 | " {} [{}{}]: {} to store, declare manifest ({} in log)", |
| 446 | style_view(&sync.remote_name), |
| 447 | scope, |
| 448 | parent, |
| 449 | format_count(sync.to_store.len(), "change"), |
| 450 | format_count(sync.manifest.changes.len(), "change"), |
| 451 | ); |
| 452 | for hash in &sync.to_store { |
| 453 | let msg = |
| 454 | load_change_message(repo, hash).unwrap_or_else(|| "(no message)".to_string()); |
| 455 | println!(" {} {}", style_hash(&format_hash(hash, false)), msg); |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | print_blank(); |
| 460 | print_hint(&format!("Remote URL: {}", remote_url)); |
| 461 | |
| 462 | Ok(()) |
| 463 | } |
| 464 | |
| 465 | /// Report a divergence conflict and build the error to return. |
| 466 | fn divergence_error( |
no test coverage detected