Print the outcome of a cross-view insert operation.
(outcome: &CrossViewInsertOutcome, dry_run: bool)
| 535 | |
| 536 | /// Print the outcome of a cross-view insert operation. |
| 537 | fn print_cross_view_outcome(outcome: &CrossViewInsertOutcome, dry_run: bool) { |
| 538 | println!(); |
| 539 | |
| 540 | if dry_run { |
| 541 | if outcome.applied_hashes.is_empty() { |
| 542 | output::print_info("Dry run: No changes would be inserted."); |
| 543 | } else { |
| 544 | output::print_info(&format!( |
| 545 | "Dry run: {} change(s) would be inserted", |
| 546 | outcome.applied_hashes.len() |
| 547 | )); |
| 548 | |
| 549 | println!(); |
| 550 | println!("Changes:"); |
| 551 | for hash in &outcome.applied_hashes { |
| 552 | println!(" {}", format_hash(hash, true)); |
| 553 | } |
| 554 | } |
| 555 | return; |
| 556 | } |
| 557 | |
| 558 | if outcome.changes_applied == 0 { |
| 559 | output::print_success("No changes to insert - already up to date."); |
| 560 | } else { |
| 561 | output::print_success(&format!("Inserted {} change(s)", outcome.changes_applied)); |
| 562 | println!(" New state: {}", outcome.new_state.to_base32()); |
| 563 | |
| 564 | if !outcome.skipped_hashes.is_empty() { |
| 565 | println!( |
| 566 | " Skipped: {} (already inserted)", |
| 567 | outcome.skipped_hashes.len() |
| 568 | ); |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | if outcome.has_conflicts { |
| 573 | println!(); |
| 574 | output::print_warning("Conflicts detected. Run 'atomic status' to see details."); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | // Tests |
| 579 |
no test coverage detected