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

Function stash_drop

atomic-cli/src/commands/rpc.rs:3871–3899  ·  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

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

Callers 1

runMethod · 0.85

Calls 5

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

Tested by

no test coverage detected