refactor: reuse branch::reset to advance main branch to next

This commit is contained in:
Paul Campbell 2024-04-11 17:45:11 +01:00
parent ab58981f87
commit 6bad8a27f7

View file

@ -166,26 +166,25 @@ fn find_next_commit_on_dev(
} }
// advance main branch to the commit 'next' // advance main branch to the commit 'next'
#[tracing::instrument(fields(next))]
pub async fn advance_main( pub async fn advance_main(
next: forge::Commit, next: forge::Commit,
repo_details: config::RepoDetails, repo_details: config::RepoDetails,
repo_config: config::RepoConfig, repo_config: config::RepoConfig,
addr: Addr<RepoActor>, addr: Addr<RepoActor>,
) { ) {
info!("Advance Main"); match reset(
let result = reset(
&repo_config.branches().main(), &repo_config.branches().main(),
next, next,
ResetForce::Normal, ResetForce::Normal,
&repo_details, &repo_details,
); ) {
match result {
Ok(_) => { Ok(_) => {
info!("Advance Next Success"); info!("Success");
addr.do_send(StartRepo); addr.do_send(StartRepo);
} }
Err(err) => { Err(err) => {
warn!(?err, "Advance Next Failed") warn!(?err, "Failed")
} }
}; };
} }