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

Function stash_apply

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

`atomic stash apply` over ApplyStash. Renders the applied-file count.

(stash: Option<String>)

Source from the content-addressed store, hash-verified

3776
3777/// `atomic stash apply` over ApplyStash. Renders the applied-file count.
3778pub fn stash_apply(stash: Option<String>) -> CliResult<bool> {
3779 let Some(session) = Service::open()? else {
3780 return Ok(false);
3781 };
3782 let request = pb::ApplyStashRequest {
3783 repository: Some(session.reference.clone()),
3784 meta: None,
3785 stash_id: stash.clone().unwrap_or_default(),
3786 };
3787 let response = session.apply_stash(request)?;
3788 if response.applied.is_empty() {
3789 print_warning("Stash was already applied or is empty");
3790 } else {
3791 print_success(&format!(
3792 "Applied {} file(s) to working copy",
3793 response.applied.len()
3794 ));
3795 }
3796 Ok(true)
3797}
3798
3799/// `atomic stash pop` composes ApplyStash then DropStash (the wire's
3800/// reserved field 4 documents exactly this client-side composition).

Callers 2

runMethod · 0.85
stash_popFunction · 0.85

Calls 6

openFunction · 0.85
print_warningFunction · 0.85
print_successFunction · 0.85
cloneMethod · 0.45
apply_stashMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected