`atomic restore --dry-run ` (the single-file form) over PreviewRestore's content arm — the handler reads the file's pristine bytes with the same domain call the local body makes; the CLI dumps them to stdout byte-for-byte (no extra output). An Added file previews the untrack instead (the local listing branch), and no pristine content is the local FileNotFound error.
(path: &str)
| 4801 | /// the untrack instead (the local listing branch), and no pristine |
| 4802 | /// content is the local FileNotFound error. |
| 4803 | pub fn restore_single_dry_run(path: &str) -> CliResult<bool> { |
| 4804 | let Some(session) = Service::open()? else { |
| 4805 | return Ok(false); |
| 4806 | }; |
| 4807 | let request = pb::PreviewRestoreRequest { |
| 4808 | repository: Some(session.reference.clone()), |
| 4809 | paths: vec![path.to_string()], |
| 4810 | force: false, |
| 4811 | content_path: Some(path.to_string()), |
| 4812 | }; |
| 4813 | let response = session.preview_restore(request)?; |
| 4814 | if !response.untracked.is_empty() { |
| 4815 | // The single Added file: the local listing branch's lines. |
| 4816 | render_restore_preview(&response, true); |
| 4817 | return Ok(true); |
| 4818 | } |
| 4819 | match response.pristine_content { |
| 4820 | Some(bytes) => { |
| 4821 | use std::io::Write; |
| 4822 | std::io::stdout() |
| 4823 | .write_all(&bytes) |
| 4824 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to write: {}", e)))?; |
| 4825 | Ok(true) |
| 4826 | } |
| 4827 | None => Err(CliError::FileNotFound { |
| 4828 | path: PathBuf::from(path), |
| 4829 | }), |
| 4830 | } |
| 4831 | } |
| 4832 | |
| 4833 | /// `atomic insert preview` over PreviewMutation (InsertPreview). |
| 4834 | pub fn insert_preview( |
no test coverage detected