`atomic stash apply` over ApplyStash. Renders the applied-file count.
(stash: Option<String>)
| 3776 | |
| 3777 | /// `atomic stash apply` over ApplyStash. Renders the applied-file count. |
| 3778 | pub 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). |
no test coverage detected