From ad7d5134810c9ec2175f15494defc6bab6a586a9 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 9 Apr 2024 22:43:54 +0100 Subject: [PATCH] feat(server): add message and handler for AdvanceMainTo(Commit) --- src/server/actors/repo/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/server/actors/repo/mod.rs b/src/server/actors/repo/mod.rs index 6684a592..59f4af27 100644 --- a/src/server/actors/repo/mod.rs +++ b/src/server/actors/repo/mod.rs @@ -122,3 +122,18 @@ impl Handler for RepoActor { self.webhook_id.replace(msg.0); } } + +#[derive(Message)] +#[rtype(result = "()")] +pub struct AdvanceMainTo(pub forge::Commit); +impl Handler for RepoActor { + type Result = (); + fn handle(&mut self, msg: AdvanceMainTo, ctx: &mut Self::Context) -> Self::Result { + let repo_details = self.details.clone(); + let addr = ctx.address(); + let net = self.net.clone(); + branch::advance_main(msg.0, repo_details, addr, net) + .into_actor(self) + .wait(ctx); + } +}