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

Method create_stash

libatomic/src/daemon/services.rs:2818–2855  ·  view source on GitHub ↗
(
        &self,
        request: Request<CreateStashRequest>,
    )

Source from the content-addressed store, hash-verified

2816 }
2817
2818 async fn create_stash(
2819 &self,
2820 request: Request<CreateStashRequest>,
2821 ) -> Result<Response<CreateStashResponse>, Status> {
2822 let request = request.into_inner();
2823 let handle = self
2824 .state
2825 .resolve(request.repository.as_ref().unwrap_or(&default_ref()))?;
2826 self.state.log_rpc("CreateStash", Some(&handle));
2827 let gate_handle = handle.clone();
2828 let _gate = gate_handle.exclusive().await;
2829 let result = tokio::task::spawn_blocking(move || -> Result<CreateStashResponse, Status> {
2830 let (mut repo, _workspace) =
2831 handle.workspace_repository(atomic_repository::WorkspaceTxnMode::Reconcile)?;
2832 match repo
2833 .stash_push(atomic_repository::StashPushOptions {
2834 message: request.message,
2835 include_untracked: request.include_untracked,
2836 keep: request.keep,
2837 })
2838 .map_err(|message| domain_status(ErrorCode::Repository, message))?
2839 {
2840 // A clean working copy is Ok(None), never an error —
2841 // the empty stash_id says "nothing to save".
2842 None => Ok(CreateStashResponse {
2843 stash_id: String::new(),
2844 meta: None,
2845 }),
2846 Some(entry) => Ok(CreateStashResponse {
2847 stash_id: entry.view_name,
2848 meta: None,
2849 }),
2850 }
2851 })
2852 .await
2853 .map_err(|error| Status::internal(format!("stash task failed: {error}")))??;
2854 Ok(Response::new(result))
2855 }
2856
2857 async fn apply_stash(
2858 &self,

Callers

nothing calls this directly

Calls 10

default_refFunction · 0.85
domain_statusFunction · 0.85
as_refMethod · 0.80
log_rpcMethod · 0.80
exclusiveMethod · 0.80
workspace_repositoryMethod · 0.80
stash_pushMethod · 0.80
into_innerMethod · 0.45
resolveMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected