MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / render_restore_preview

Function render_restore_preview

atomic-cli/src/commands/rpc.rs:4791–4817  ·  view source on GitHub ↗

The shared render for the restore previews — the local listing branch's exact lines over the wire-carried classification.

(response: &pb::PreviewMutationResponse, partial: bool)

Source from the content-addressed store, hash-verified

4789/// The shared render for the restore previews — the local listing
4790/// branch's exact lines over the wire-carried classification.
4791fn render_restore_preview(response: &pb::PreviewMutationResponse, partial: bool) {
4792 if response.affected_paths.is_empty() && response.untracked.is_empty() {
4793 // The local body's partial/whole split: naming paths must not
4794 // claim the whole working copy is clean.
4795 println!(
4796 "{}",
4797 if partial {
4798 "Nothing to restore for the specified path(s)"
4799 } else {
4800 "Nothing to restore - working copy is clean"
4801 }
4802 );
4803 return;
4804 }
4805 for path in &response.affected_paths {
4806 println!("Would restore: {path}");
4807 }
4808 for path in &response.untracked {
4809 println!("Would untrack: {path} (kept on disk)");
4810 }
4811 println!();
4812 let total = response.affected_paths.len() + response.untracked.len();
4813 print_hint(&format!(
4814 "(dry run - {} would be restored)",
4815 super::restore::format_count(total, "file")
4816 ));
4817}
4818
4819/// `atomic restore --dry-run` (the listing form) over PreviewRestore —
4820/// the would-restore / would-untrack split rides the response.

Callers 2

restore_previewFunction · 0.85
restore_single_dry_runFunction · 0.85

Calls 3

print_hintFunction · 0.85
is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected