feat(server): add message and handler for AdvanceMainTo(Commit)

This commit is contained in:
Paul Campbell 2024-04-09 22:43:54 +01:00
parent 7ed30fc382
commit ad7d513481

View file

@ -122,3 +122,18 @@ impl Handler<WebhookRegistered> for RepoActor {
self.webhook_id.replace(msg.0);
}
}
#[derive(Message)]
#[rtype(result = "()")]
pub struct AdvanceMainTo(pub forge::Commit);
impl Handler<AdvanceMainTo> 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);
}
}