`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)
| 4841 | /// the untrack instead (the local listing branch), and no pristine |
| 4842 | /// content is the local FileNotFound error. |
| 4843 | pub fn restore_single_dry_run(path: &str) -> CliResult<bool> { |
| 4844 | let Some(session) = Service::open()? else { |
| 4845 | return Ok(false); |
| 4846 | }; |
| 4847 | let request = pb::PreviewRestoreRequest { |
| 4848 | repository: Some(session.reference.clone()), |
| 4849 | paths: vec![path.to_string()], |
| 4850 | force: false, |
| 4851 | content_path: Some(path.to_string()), |
| 4852 | }; |
| 4853 | let response = session.preview_restore(request)?; |
| 4854 | if !response.untracked.is_empty() { |
| 4855 | // The single Added file: the local listing branch's lines. |
| 4856 | render_restore_preview(&response, true); |
| 4857 | return Ok(true); |
| 4858 | } |
| 4859 | match response.pristine_content { |
| 4860 | Some(bytes) => { |
| 4861 | use std::io::Write; |
| 4862 | std::io::stdout() |
| 4863 | .write_all(&bytes) |
| 4864 | .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to write: {}", e)))?; |
| 4865 | Ok(true) |
| 4866 | } |
| 4867 | None => Err(CliError::FileNotFound { |
| 4868 | path: PathBuf::from(path), |
| 4869 | }), |
| 4870 | } |
| 4871 | } |
| 4872 | |
| 4873 | /// `atomic insert preview` over PreviewMutation (InsertPreview). |
| 4874 | pub fn insert_preview( |
no test coverage detected