Display the dry run preview: per-view manifest sync plans.
(
&self,
repo: &Repository,
remote_name: &str,
remote_url: &str,
syncs: &[ViewSync],
)
| 311 | |
| 312 | /// Display the dry run preview: per-view manifest sync plans. |
| 313 | fn display_dry_run( |
| 314 | &self, |
| 315 | repo: &Repository, |
| 316 | remote_name: &str, |
| 317 | remote_url: &str, |
| 318 | syncs: &[ViewSync], |
| 319 | ) -> CliResult<()> { |
| 320 | let active: Vec<&ViewSync> = syncs.iter().filter(|s| !s.plan.is_noop()).collect(); |
| 321 | |
| 322 | if active.is_empty() { |
| 323 | print_success("Already up to date - nothing to push"); |
| 324 | return Ok(()); |
| 325 | } |
| 326 | |
| 327 | println!( |
| 328 | "Would sync {} to {}:", |
| 329 | format_count(active.len(), "view"), |
| 330 | remote_name |
| 331 | ); |
| 332 | print_blank(); |
| 333 | |
| 334 | for sync in &active { |
| 335 | let scope = sync.manifest.scope.to_string(); |
| 336 | let parent = sync |
| 337 | .manifest |
| 338 | .parent |
| 339 | .as_deref() |
| 340 | .map(|p| format!(", parent {}", p)) |
| 341 | .unwrap_or_default(); |
| 342 | println!( |
| 343 | " {} [{}{}]: {} to store, declare manifest ({} in log)", |
| 344 | style_view(&sync.remote_name), |
| 345 | scope, |
| 346 | parent, |
| 347 | format_count(sync.to_store.len(), "change"), |
| 348 | format_count(sync.manifest.changes.len(), "change"), |
| 349 | ); |
| 350 | for hash in &sync.to_store { |
| 351 | let msg = |
| 352 | load_change_message(repo, hash).unwrap_or_else(|| "(no message)".to_string()); |
| 353 | println!(" {} {}", style_hash(&format_hash(hash, false)), msg); |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | print_blank(); |
| 358 | print_hint(&format!("Remote URL: {}", remote_url)); |
| 359 | |
| 360 | Ok(()) |
| 361 | } |
| 362 | |
| 363 | /// Report a divergence conflict and build the error to return. |
| 364 | fn divergence_error( |
no test coverage detected