mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-03 15:33:13 +03:00
expose cherry pick api
This commit is contained in:
parent
552fe0c5cd
commit
04007e5e87
@ -193,6 +193,7 @@ fn main() {
|
||||
virtual_branches::commands::can_apply_remote_branch,
|
||||
virtual_branches::commands::list_remote_commit_files,
|
||||
virtual_branches::commands::reset_virtual_branch,
|
||||
virtual_branches::commands::cherry_pick_onto_virtual_branch,
|
||||
keys::commands::get_public_key,
|
||||
github::commands::init_device_oauth,
|
||||
github::commands::check_auth_status,
|
||||
|
@ -416,3 +416,30 @@ pub async fn reset_virtual_branch(
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
#[instrument(skip(handle))]
|
||||
pub async fn cherry_pick_onto_virtual_branch(
|
||||
handle: AppHandle,
|
||||
project_id: &str,
|
||||
branch_id: &str,
|
||||
target_commit_oid: &str,
|
||||
) -> Result<Option<git::Oid>, Error> {
|
||||
let project_id = project_id.parse().map_err(|_| Error::UserError {
|
||||
code: Code::Validation,
|
||||
message: "Malformed project id".to_string(),
|
||||
})?;
|
||||
let branch_id = branch_id.parse().map_err(|_| Error::UserError {
|
||||
code: Code::Validation,
|
||||
message: "Malformed branch id".to_string(),
|
||||
})?;
|
||||
let target_commit_oid = target_commit_oid.parse().map_err(|_| Error::UserError {
|
||||
code: Code::Validation,
|
||||
message: "Malformed commit oid".to_string(),
|
||||
})?;
|
||||
handle
|
||||
.state::<Controller>()
|
||||
.cherry_pick(&project_id, &branch_id, target_commit_oid)
|
||||
.await
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user