Display the dry run preview: per-view manifest sync plans.
(
&self,
repo: &Repository,
remote_name: &str,
remote_url: &str,
syncs: &[ViewSync],
)
| 392 | |
| 393 | /// Display the dry run preview: per-view manifest sync plans. |
| 394 | fn display_dry_run( |
| 395 | &self, |
| 396 | repo: &Repository, |
| 397 | remote_name: &str, |
| 398 | remote_url: &str, |
| 399 | syncs: &[ViewSync], |
| 400 | ) -> CliResult<()> { |
| 401 | let active: Vec<&ViewSync> = syncs.iter().filter(|s| !s.plan.is_noop()).collect(); |
| 402 | |
| 403 | if active.is_empty() { |
| 404 | print_success("Already up to date - nothing to push"); |
| 405 | return Ok(()); |
| 406 | } |
| 407 | |
| 408 | println!( |
| 409 | "Would sync {} to {}:", |
| 410 | format_count(active.len(), "view"), |
| 411 | remote_name |
| 412 | ); |
| 413 | print_blank(); |
| 414 | |
| 415 | for sync in &active { |
| 416 | let scope = sync.manifest.scope.to_string(); |
| 417 | let parent = sync |
| 418 | .manifest |
| 419 | .parent |
| 420 | .as_deref() |
| 421 | .map(|p| format!(", parent {}", p)) |
| 422 | .unwrap_or_default(); |
| 423 | println!( |
| 424 | " {} [{}{}]: {} to store, declare manifest ({} in log)", |
| 425 | style_view(&sync.remote_name), |
| 426 | scope, |
| 427 | parent, |
| 428 | format_count(sync.to_store.len(), "change"), |
| 429 | format_count(sync.manifest.changes.len(), "change"), |
| 430 | ); |
| 431 | for hash in &sync.to_store { |
| 432 | let msg = |
| 433 | load_change_message(repo, hash).unwrap_or_else(|| "(no message)".to_string()); |
| 434 | println!(" {} {}", style_hash(&format_hash(hash, false)), msg); |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | print_blank(); |
| 439 | print_hint(&format!("Remote URL: {}", remote_url)); |
| 440 | |
| 441 | Ok(()) |
| 442 | } |
| 443 | |
| 444 | /// Report a divergence conflict and build the error to return. |
| 445 | fn divergence_error( |
no test coverage detected