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

Function stash_drop

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

`atomic stash drop` over DropStash (all=true covers `stash clear`, which routes without its confirmation prompt — the prompt is the client's job).

(stash: Option<String>, all: bool)

Source from the content-addressed store, hash-verified

3870/// which routes without its confirmation prompt — the prompt is the
3871/// client's job).
3872pub fn stash_drop(stash: Option<String>, all: bool) -> CliResult<bool> {
3873 let Some(session) = Service::open()? else {
3874 return Ok(false);
3875 };
3876 // Resolve a bare drop to the newest stash for the display reference.
3877 let (stash_id, display) = match stash {
3878 Some(stash) => (stash.clone(), stash),
3879 None => {
3880 let stashes = list_stashes_raw(&session)?;
3881 match stashes.first() {
3882 Some(first) => (first.id.clone(), "stash@{0}".to_string()),
3883 None => {
3884 return Err(CliError::InvalidArgument {
3885 message: "No stashes found".to_string(),
3886 })
3887 }
3888 }
3889 }
3890 };
3891 let request = pb::DropStashRequest {
3892 repository: Some(session.reference.clone()),
3893 meta: None,
3894 stash_id: Some(stash_id),
3895 all,
3896 };
3897 session.drop_stash(request)?;
3898 print_success(&format!("Dropped {display}"));
3899 Ok(true)
3900}
3901
3902fn list_stashes_raw(session: &Service) -> CliResult<Vec<pb::StashInfo>> {
3903 let request = pb::ListStashesRequest {

Callers 1

runMethod · 0.85

Calls 5

list_stashes_rawFunction · 0.85
print_successFunction · 0.85
openFunction · 0.50
cloneMethod · 0.45
drop_stashMethod · 0.45

Tested by

no test coverage detected