Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
feat: use the same Oid type everywhere
Merged liw opened 1 year ago

Previously we imported the Oid type (for Git object identifiers) different places. This was confusing, and also meant that upgrading a dependency (radicle-git-ext) broke, because two types with the same name imported from different versions of the same crate are different types.

Change this so that radicle::git::Oid is the one true Oid type we use.

Signed-off-by: Lars Wirzenius liw@liw.fi

8 files changed +8 -12 00ca0e8f c45291bc
modified src/bin/cibtool.rs
@@ -21,12 +21,11 @@ use clap::Parser;
use serde::Serialize;

use radicle::{
-
    git::RefString,
+
    git::{Oid, RefString},
    prelude::{NodeId, RepoId},
    storage::ReadStorage,
    Profile, Storage,
};
-
use radicle_git_ext::Oid;

use radicle_ci_broker::{
    broker::BrokerError,
modified src/ci_event.rs
@@ -3,11 +3,10 @@ use std::path::{Path, PathBuf};
use regex::Regex;
use serde::{Deserialize, Serialize};

-
use radicle_git_ext::Oid;
-

use radicle::{
    cob::patch::PatchId,
    crypto::PublicKey,
+
    git::Oid,
    git::RefString,
    node::{Event, NodeId},
    prelude::RepoId,
modified src/filter.rs
@@ -4,12 +4,11 @@ use serde::{Deserialize, Serialize};

use radicle::{
    cob::patch::PatchId,
-
    git::{raw::ObjectType, RefString},
+
    git::{raw::ObjectType, Oid, RefString},
    node::NodeId,
    prelude::{Profile, RepoId},
    storage::git::Repository,
};
-
use radicle_git_ext::Oid;

use crate::{
    ci_event::{namespaced_branch, CiEvent, CiEventV1},
modified src/logger.rs
@@ -3,7 +3,7 @@
use std::{path::Path, process::ExitStatus, time::Duration};

use clap::ValueEnum;
-
use radicle::{git::raw::Oid, identity::RepoId, node::Event, patch::PatchId};
+
use radicle::{git::Oid, identity::RepoId, node::Event, patch::PatchId};
use serde_json::Value;
use tracing::{debug, error, info, trace, warn, Level};
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
modified src/msg.rs
@@ -1226,9 +1226,8 @@ pub mod helper {
    use std::{path::Path, process::Command};

    use radicle::prelude::{Profile, RepoId};
-
    use radicle_git_ext::Oid;

-
    use super::{MessageError, Request, Response, RunId, RunResult};
+
    use super::{MessageError, Oid, Request, Response, RunId, RunResult};

    /// Exit code to indicate we didn't get one from the process.
    pub const NO_EXIT: i32 = 999;
modified src/pages.rs
@@ -22,7 +22,7 @@ use serde::Serialize;
use time::{macros::format_description, OffsetDateTime};

use radicle::{
-
    git::ext::Oid,
+
    git::Oid,
    prelude::RepoId,
    storage::{ReadRepository, ReadStorage},
    Profile,
modified src/subplot.rs
@@ -10,12 +10,12 @@ use std::{
};

use radicle::{
+
    git::Oid,
    git::RefString,
    node::{Event, NodeId},
    prelude::RepoId,
    storage::RefUpdate,
};
-
use radicle_git_ext::Oid;

use subplotlib::steplibrary::datadir::Datadir;
use subplotlib::steplibrary::runcmd::Runcmd;
modified src/util.rs
@@ -12,11 +12,11 @@ use time::{

use radicle::{
    cob::ObjectId,
+
    git::Oid,
    prelude::{NodeId, RepoId},
    storage::ReadStorage,
    Profile, Storage,
};
-
use radicle_git_ext::Oid;

pub fn lookup_repo(profile: &Profile, wanted: &str) -> Result<(RepoId, String), UtilError> {
    let storage = Storage::open(profile.storage(), profile.info()).map_err(UtilError::Storage)?;