From 7ed30fc382d95f2a4ad3dbd15d9a0fdaedd2f273 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 9 Apr 2024 22:43:23 +0100 Subject: [PATCH] feat(server): add stub for branch::advance_main --- src/server/actors/repo/branch.rs | 38 +++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/server/actors/repo/branch.rs b/src/server/actors/repo/branch.rs index 177833d..9d11ad1 100644 --- a/src/server/actors/repo/branch.rs +++ b/src/server/actors/repo/branch.rs @@ -1,18 +1,21 @@ +use actix::prelude::*; + +use kxio::network; use tracing::{error, warn}; -use crate::server::forge; +use crate::server::{config, forge}; -use super::StartMonitoring; +use super::{RepoActor, StartMonitoring, StartRepo}; #[tracing::instrument(fields(forge_name = %repo_details.forge.name, repo_name = %repo_details.name))] pub async fn validate_positions( - repo_details: crate::server::config::RepoDetails, - config: crate::server::config::RepoConfig, - addr: actix::prelude::Addr, - net: kxio::network::Network, + repo_details: config::RepoDetails, + config: config::RepoConfig, + addr: Addr, + net: network::Network, ) { let commit_histories = match repo_details.forge.forge_type { - crate::server::config::ForgeType::ForgeJo => { + config::ForgeType::ForgeJo => { forge::forgejo::get_commit_histories(&repo_details, &config, &net).await } }; @@ -67,11 +70,26 @@ pub async fn validate_positions( addr.do_send(StartMonitoring { main, next, dev }); } +// advance next to the next commit towards the head of the dev branch +#[allow(dead_code)] pub async fn advance_next( _next: forge::Commit, - _repo_details: crate::server::config::RepoDetails, - _addr: actix::prelude::Addr, - _net: kxio::network::Network, + _repo_details: config::RepoDetails, + addr: Addr, + _net: network::Network, ) { // TODO: (#14) advance next one commit towards dev + addr.do_send(StartRepo); +} + +// advance main branch to the commit 'next' +#[allow(dead_code)] +pub async fn advance_main( + _next: forge::Commit, + _repo_details: config::RepoDetails, + addr: Addr, + _net: network::Network, +) { + // TODO: (#19) advance main to next + addr.do_send(StartRepo); }