Print the outcome of a cross-view insert operation.
(outcome: &CrossViewInsertOutcome, dry_run: bool)
| 705 | |
| 706 | /// Print the outcome of a cross-view insert operation. |
| 707 | fn print_cross_view_outcome(outcome: &CrossViewInsertOutcome, dry_run: bool) { |
| 708 | println!(); |
| 709 | |
| 710 | if dry_run { |
| 711 | if outcome.applied_hashes.is_empty() { |
| 712 | output::print_info("Dry run: No changes would be inserted."); |
| 713 | } else { |
| 714 | output::print_info(&format!( |
| 715 | "Dry run: {} change(s) would be inserted", |
| 716 | outcome.applied_hashes.len() |
| 717 | )); |
| 718 | |
| 719 | println!(); |
| 720 | println!("Changes:"); |
| 721 | for hash in &outcome.applied_hashes { |
| 722 | println!(" {}", format_hash(hash, true)); |
| 723 | } |
| 724 | } |
| 725 | return; |
| 726 | } |
| 727 | |
| 728 | if outcome.changes_applied == 0 { |
| 729 | output::print_success("No changes to insert - already up to date."); |
| 730 | } else { |
| 731 | output::print_success(&format!("Inserted {} change(s)", outcome.changes_applied)); |
| 732 | println!(" New state: {}", outcome.new_state.to_base32()); |
| 733 | |
| 734 | if !outcome.skipped_hashes.is_empty() { |
| 735 | println!( |
| 736 | " Skipped: {} (already inserted)", |
| 737 | outcome.skipped_hashes.len() |
| 738 | ); |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | if outcome.has_conflicts { |
| 743 | println!(); |
| 744 | output::print_warning("Conflicts detected. Run 'atomic conflicts' to see details."); |
| 745 | } |
| 746 | } |
| 747 | |
| 748 | // Tests |
| 749 |
no test coverage detected