diff --git a/src/server/actors/repo/branch.rs b/src/server/actors/repo/branch.rs index c19cf43..259f4bd 100644 --- a/src/server/actors/repo/branch.rs +++ b/src/server/actors/repo/branch.rs @@ -108,6 +108,7 @@ pub async fn validate_positions( } // advance next to the next commit towards the head of the dev branch +#[tracing::instrument(fields(next), skip_all)] pub async fn advance_next( next: forge::Commit, dev_commit_history: Vec, @@ -115,38 +116,23 @@ pub async fn advance_next( repo_config: config::RepoConfig, addr: Addr, ) { - info!("Advance Next"); - let user = repo_details.forge.user; - let token = repo_details.forge.token; - let hostname = repo_details.forge.hostname; - let path = repo_details.repo; let next_commit = find_next_commit_on_dev(next, dev_commit_history); let Some(commit) = next_commit else { warn!("No commits to advance next to"); return; }; - let next = repo_config.branches().next(); - let command = - format!("/usr/bin/git push https://{user}:{token}@{hostname}/{path}.git {commit}:{next}"); - info!("Running command: {}", command); - match gix::command::prepare(command) - .with_shell_allow_argument_splitting() - .spawn() - { - Ok(mut child) => { - match child.wait() { - Ok(exit_status) => { - info!(%exit_status, "Advance Next Success"); - tokio::time::sleep(std::time::Duration::from_secs(10)).await; - addr.do_send(StartRepo); - } - Err(err) => { - warn!(?err, "Advance Next Failed (wait)") - } - }; + match reset( + &repo_config.branches().next(), + commit, + ResetForce::Normal, + &repo_details, + ) { + Ok(_) => { + info!("Success"); + addr.do_send(StartRepo); } Err(err) => { - warn!(?err, "Advance Next Failed (spawn)") + warn!(?err, "Failed") } }; } @@ -166,7 +152,7 @@ fn find_next_commit_on_dev( } // advance main branch to the commit 'next' -#[tracing::instrument(fields(next))] +#[tracing::instrument(fields(next), skip_all)] pub async fn advance_main( next: forge::Commit, repo_details: config::RepoDetails,