(
&self,
request: Request<ApplyStashRequest>,
)
| 2820 | } |
| 2821 | |
| 2822 | async fn apply_stash( |
| 2823 | &self, |
| 2824 | request: Request<ApplyStashRequest>, |
| 2825 | ) -> Result<Response<ApplyStashResponse>, Status> { |
| 2826 | let request = request.into_inner(); |
| 2827 | let handle = self |
| 2828 | .state |
| 2829 | .resolve(request.repository.as_ref().unwrap_or(&default_ref()))?; |
| 2830 | self.state.log_rpc("ApplyStash", Some(&handle)); |
| 2831 | let gate_handle = handle.clone(); |
| 2832 | let _gate = gate_handle.exclusive().await; |
| 2833 | let result = tokio::task::spawn_blocking(move || -> Result<ApplyStashResponse, Status> { |
| 2834 | let (repo, _workspace) = |
| 2835 | handle.workspace_repository(atomic_repository::WorkspaceTxnMode::Reconcile)?; |
| 2836 | let (_stash, applied) = repo |
| 2837 | .stash_apply(if request.stash_id.is_empty() { |
| 2838 | None |
| 2839 | } else { |
| 2840 | Some(request.stash_id.as_str()) |
| 2841 | }) |
| 2842 | .map_err(|message| domain_status(ErrorCode::Repository, message))?; |
| 2843 | Ok(ApplyStashResponse { |
| 2844 | applied, |
| 2845 | meta: None, |
| 2846 | }) |
| 2847 | }) |
| 2848 | .await |
| 2849 | .map_err(|error| Status::internal(format!("stash task failed: {error}")))??; |
| 2850 | Ok(Response::new(result)) |
| 2851 | } |
| 2852 | |
| 2853 | async fn list_stashes( |
| 2854 | &self, |
nothing calls this directly
no test coverage detected