`atomic restore` over Restore. The non-dry-run forms route; every dry-run form routes through the PreviewRestore arm the command dispatches next — the listing form (no paths, or more than one) via `restore_preview`, the single-file pristine-bytes dump via `restore_single_dry_run` (the wire's content arm). The whole-copy refusal surfaces with the daemon's message.
(args: &super::restore::Restore)
| 3717 | /// `restore_single_dry_run` (the wire's content arm). The whole-copy |
| 3718 | /// refusal surfaces with the daemon's message. |
| 3719 | pub fn restore(args: &super::restore::Restore) -> CliResult<bool> { |
| 3720 | if args.dry_run { |
| 3721 | return Ok(false); |
| 3722 | } |
| 3723 | let Some(session) = Service::open()? else { |
| 3724 | return Ok(false); |
| 3725 | }; |
| 3726 | let request = pb::RestoreRequest { |
| 3727 | repository: Some(session.reference.clone()), |
| 3728 | meta: None, |
| 3729 | paths: args.files.clone(), |
| 3730 | force: args.force, |
| 3731 | }; |
| 3732 | let response = session.restore(request)?; |
| 3733 | |
| 3734 | if response.restored.is_empty() { |
| 3735 | println!("Nothing to restore - working copy is clean"); |
| 3736 | return Ok(true); |
| 3737 | } |
| 3738 | println!("Restoring working copy..."); |
| 3739 | for path in &response.restored { |
| 3740 | println!(" Restored: {path}"); |
| 3741 | } |
| 3742 | println!(); |
| 3743 | print_success(&format!("Restored {} file(s)", response.restored.len())); |
| 3744 | Ok(true) |
| 3745 | } |
| 3746 | |
| 3747 | // --------------------------------------------------------------------------- |
| 3748 | // stash (RepositoryMutationService) |