Print the outcome of a cross-view insert operation.
(outcome: &CrossViewInsertOutcome, dry_run: bool)
| 810 | |
| 811 | /// Print the outcome of a cross-view insert operation. |
| 812 | pub(crate) fn print_cross_view_outcome(outcome: &CrossViewInsertOutcome, dry_run: bool) { |
| 813 | println!(); |
| 814 | |
| 815 | if dry_run { |
| 816 | if outcome.applied_hashes.is_empty() { |
| 817 | output::print_info("Dry run: No changes would be inserted."); |
| 818 | } else { |
| 819 | output::print_info(&format!( |
| 820 | "Dry run: {} change(s) would be inserted", |
| 821 | outcome.applied_hashes.len() |
| 822 | )); |
| 823 | |
| 824 | println!(); |
| 825 | println!("Changes:"); |
| 826 | for hash in &outcome.applied_hashes { |
| 827 | println!(" {}", format_hash(hash, true)); |
| 828 | } |
| 829 | } |
| 830 | return; |
| 831 | } |
| 832 | |
| 833 | if outcome.changes_applied == 0 { |
| 834 | output::print_success("No changes to insert - already up to date."); |
| 835 | } else { |
| 836 | output::print_success(&format!("Inserted {} change(s)", outcome.changes_applied)); |
| 837 | println!(" New state: {}", outcome.new_state.to_base32()); |
| 838 | |
| 839 | if !outcome.skipped_hashes.is_empty() { |
| 840 | println!( |
| 841 | " Skipped: {} (already inserted)", |
| 842 | outcome.skipped_hashes.len() |
| 843 | ); |
| 844 | } |
| 845 | } |
| 846 | |
| 847 | if outcome.has_conflicts { |
| 848 | println!(); |
| 849 | output::print_warning("Conflicts detected. Run 'atomic conflicts' to see details."); |
| 850 | } |
| 851 | } |
| 852 | |
| 853 | // Tests |
| 854 |
no test coverage detected