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

Function unrecord_preview

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

`atomic unrecord --dry-run` over PreviewMutation (UnrecordPreview). Only the bare form routes (absent = last change); a change argument needs the local resolver's exact semantics — see `unrecord`.

(change: Option<String>)

Source from the content-addressed store, hash-verified

4932/// Only the bare form routes (absent = last change); a change argument
4933/// needs the local resolver's exact semantics — see `unrecord`.
4934pub fn unrecord_preview(change: Option<String>) -> CliResult<bool> {
4935 let Some(session) = Service::open()? else {
4936 return Ok(false);
4937 };
4938 let target = change.map(|prefix| pb::ChangeRef {
4939 kind: Some(pb::change_ref::Kind::Prefix(prefix)),
4940 });
4941 let request = pb::PreviewMutationRequest {
4942 repository: Some(session.reference.clone()),
4943 operation: Some(pb::preview_mutation_request::Operation::Unrecord(
4944 pb::UnrecordPreview { view: None, target },
4945 )),
4946 };
4947 let response = session.preview_mutation(request)?;
4948 for change in &response.changes {
4949 let hash = full_hash(&change.hash);
4950 print_warning(&format!("Would unrecord: {hash}"));
4951 }
4952 Ok(true)
4953}
4954
4955/// Resolve a hash prefix to the full hash through the service layer —
4956/// Log entries, newest first, the same resolution the in-process

Callers 1

runMethod · 0.85

Calls 6

UnrecordClass · 0.85
full_hashFunction · 0.85
print_warningFunction · 0.85
openFunction · 0.50
cloneMethod · 0.45
preview_mutationMethod · 0.45

Tested by

no test coverage detected