Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
fix: adapt to radicle's Id->RepoId rename
Lars Wirzenius committed 2 years ago
commit c7a2572e805c4c9271cabeee0451028d58bf1d20
parent a3a8a222a601f4f09196e1cee9610270a11816bb
5 files changed +13 -13
modified src/bin/broker-messages.rs
@@ -1,7 +1,7 @@
-
use radicle_ci_broker::msg::{Id, Oid, Request, Response, RunId, RunResult};
+
use radicle_ci_broker::msg::{Oid, RepoId, Request, Response, RunId, RunResult};

fn main() {
-
    let rid = Id::from_urn("rad:zwTxygwuz5LDGBq255RA2CbNGrz8").expect("create rid");
+
    let rid = RepoId::from_urn("rad:zwTxygwuz5LDGBq255RA2CbNGrz8").expect("create rid");
    let commit =
        Oid::try_from("b4fb1e347be7db19f0859717062f94116b5bec9f").expect("create commit id");

modified src/bin/ci-broker.rs
@@ -7,7 +7,7 @@ use std::{

use log::{debug, info};

-
use radicle::prelude::{Id, Profile};
+
use radicle::prelude::{Profile, RepoId};
use radicle_ci_broker::{
    config::{Adapter, Config},
    error::BrokerError,
@@ -75,7 +75,7 @@ fn fallible_main() -> Result<(), BrokerError> {
    }
}

-
fn run(adapter: &Adapter, repo: Id, commit: Oid) -> Result<Option<RunResult>, BrokerError> {
+
fn run(adapter: &Adapter, repo: RepoId, commit: Oid) -> Result<Option<RunResult>, BrokerError> {
    info!("Trigger on {}, {}", repo, commit);

    debug!("Spawning child process");
modified src/event.rs
@@ -19,7 +19,7 @@ use crate::filter::{BrokerEvent, EventFilter};
/// filter are returned. See [`NodeEventSource::allow`] and
/// [`EventFilter`].
pub struct NodeEventSource {
-
    events: Box<dyn Iterator<Item = Result<Event, std::io::Error>>>,
+
    events: Box<dyn Iterator<Item = Result<Event, radicle::node::Error>>>,
    allowed: Vec<EventFilter>,
}

modified src/filter.rs
@@ -29,7 +29,7 @@ use std::{fs::read, path::Path};

use radicle::{node::Event, storage::RefUpdate};

-
use radicle::prelude::Id;
+
use radicle::prelude::RepoId;
use radicle_git_ext::{ref_format::RefString, Oid};
use serde::{Deserialize, Serialize};

@@ -42,7 +42,7 @@ use crate::event::NodeEventError;
#[serde(deny_unknown_fields)]
pub enum EventFilter {
    /// Event concerns a specific repository.
-
    Repository(Id),
+
    Repository(RepoId),

    /// Event concerns a git ref that ends with a given string.
    RefSuffix(String),
@@ -69,7 +69,7 @@ pub enum EventFilter {
impl EventFilter {
    /// Create a filter for a repository.
    pub fn repository(rid: &str) -> Result<Self, NodeEventError> {
-
        Ok(Self::Repository(Id::from_urn(rid)?))
+
        Ok(Self::Repository(RepoId::from_urn(rid)?))
    }

    /// Create a filter for a git ref that ends with a string.
@@ -141,7 +141,7 @@ pub enum BrokerEvent {
    /// of a changed ref.
    RefChanged {
        /// Repository id.
-
        rid: Id,
+
        rid: RepoId,
        /// Ref name.
        name: RefString,
        /// New git commit.
@@ -150,7 +150,7 @@ pub enum BrokerEvent {
}

impl BrokerEvent {
-
    fn new(rid: &Id, name: &RefString, oid: &Oid) -> Self {
+
    fn new(rid: &RepoId, name: &RefString, oid: &Oid) -> Self {
        Self::RefChanged {
            rid: *rid,
            name: name.clone(),
modified src/msg.rs
@@ -12,7 +12,7 @@ use std::{
use serde::{Deserialize, Serialize};

pub use radicle::git::Oid;
-
pub use radicle::prelude::{Id, NodeId};
+
pub use radicle::prelude::{NodeId, RepoId};

/// The type of a run identifier. For maximum generality, this is a
/// string rather than an integer.
@@ -73,12 +73,12 @@ impl fmt::Display for RunResult {
#[non_exhaustive]
pub enum Request {
    /// Trigger a run.
-
    Trigger { repo: Id, commit: Oid },
+
    Trigger { repo: RepoId, commit: Oid },
}

impl Request {
    /// Create an event to trigger a run.
-
    pub fn trigger(repo: Id, commit: Oid) -> Self {
+
    pub fn trigger(repo: RepoId, commit: Oid) -> Self {
        Self::Trigger { repo, commit }
    }