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

Method dry_run_single_file

atomic-cli/src/commands/restore.rs:228–249  ·  view source on GitHub ↗

Execute dry-run for a single file - output pristine content to stdout.

(&self, repo: &Repository, view: &str, path: &str)

Source from the content-addressed store, hash-verified

226
227 /// Execute dry-run for a single file - output pristine content to stdout.
228 fn dry_run_single_file(&self, repo: &Repository, view: &str, path: &str) -> CliResult<()> {
229 // Get file content from pristine
230 let content = repo
231 .get_file_content_on_view(Path::new(path), view)
232 .map_err(|e| {
233 CliError::Internal(anyhow::anyhow!("Failed to get file content: {}", e))
234 })?;
235
236 match content {
237 Some(bytes) => {
238 // Output to stdout
239 use std::io::Write;
240 std::io::stdout()
241 .write_all(&bytes)
242 .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to write: {}", e)))?;
243 Ok(())
244 }
245 None => Err(CliError::FileNotFound {
246 path: PathBuf::from(path),
247 }),
248 }
249 }
250
251 /// Classify and restore every Modified/Deleted path in one pass, returning
252 /// the outcome for each path so the caller can report them in status order.

Callers 1

runMethod · 0.80

Calls 2

stdoutFunction · 0.85

Tested by

no test coverage detected