Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle: re-export radicle_core::RepoId
◌ CI pending Fintan Halpenny committed 3 months ago
commit 0e8ecce342ade013a4fb406289972df1b4922826
parent 674a3b5b3f23e352a9458e117ff31d78feddbaf9
1 pending (1 total) View logs
4 files changed +12 -38
modified crates/radicle/Cargo.toml
@@ -13,7 +13,16 @@ rust-version.workspace = true
default = []
test = ["tempfile", "qcheck", "radicle-crypto/test", "radicle-cob/test"]
logger = ["colored", "chrono"]
-
schemars = ["radicle-oid/schemars", "radicle-localtime/schemars", "dep:schemars"]
+
qcheck = [
+
  "radicle-core/qcheck",
+
  "dep:qcheck"
+
]
+
schemars = [
+
  "radicle-oid/schemars",
+
  "radicle-core/schemars",
+
  "radicle-localtime/schemars",
+
  "dep:schemars"
+
]

[dependencies]
amplify = { workspace = true, features = ["std"] }
@@ -33,7 +42,7 @@ multibase = { workspace = true }
nonempty = { workspace = true, features = ["serialize"] }
qcheck = { workspace = true, optional = true }
radicle-cob = { workspace = true, features = ["git2"] }
-
radicle-core = { workspace = true, features = ["git2"] }
+
radicle-core = { workspace = true, features = ["git2", "serde", "sqlite"] }
radicle-crypto = { workspace = true, features = ["git-ref-format-core", "ssh", "sqlite", "cyphernet"] }
radicle-git-ref-format = { workspace = true, features = ["macro", "serde"] }
radicle-localtime = { workspace = true, features = ["serde"] }
modified crates/radicle/src/identity/doc.rs
@@ -1,7 +1,5 @@
pub mod update;

-
mod id;
-

use std::collections::{BTreeMap, BTreeSet};
use std::fmt;
use std::num::{NonZeroU32, NonZeroUsize};
@@ -29,7 +27,7 @@ use crate::storage;
use crate::storage::{ReadRepository, RepositoryError};

pub use crypto::PublicKey;
-
pub use id::*;
+
pub use radicle_core::repo::*;

use super::crefs::{self, RawCanonicalRefs};
use super::CanonicalRefs;
modified crates/radicle/src/sql.rs
@@ -4,7 +4,6 @@ use std::str::FromStr;
use sqlite as sql;
use sqlite::Value;

-
use crate::identity::RepoId;
use crate::node;
use crate::node::{Address, UserAgent};

@@ -28,29 +27,6 @@ pub fn transaction<T, E: From<sql::Error>>(
    }
}

-
impl TryFrom<&Value> for RepoId {
-
    type Error = sql::Error;
-

-
    fn try_from(value: &Value) -> Result<Self, Self::Error> {
-
        match value {
-
            Value::String(id) => RepoId::from_urn(id).map_err(|e| sql::Error {
-
                code: None,
-
                message: Some(e.to_string()),
-
            }),
-
            _ => Err(sql::Error {
-
                code: None,
-
                message: Some(format!("sql: invalid type `{:?}` for id", value.kind())),
-
            }),
-
        }
-
    }
-
}
-

-
impl sqlite::BindableWithIndex for &RepoId {
-
    fn bind<I: sql::ParameterIndex>(self, stmt: &mut sql::Statement<'_>, i: I) -> sql::Result<()> {
-
        self.urn().as_str().bind(stmt, i)
-
    }
-
}
-

impl sql::BindableWithIndex for node::Features {
    fn bind<I: sql::ParameterIndex>(self, stmt: &mut sql::Statement<'_>, i: I) -> sql::Result<()> {
        (*self.deref() as i64).bind(stmt, i)
modified crates/radicle/src/test/arbitrary.rs
@@ -270,15 +270,6 @@ impl Arbitrary for storage::Remote<crypto::Unverified> {
    }
}

-
impl Arbitrary for RepoId {
-
    fn arbitrary(g: &mut qcheck::Gen) -> Self {
-
        let bytes = <[u8; 20]>::arbitrary(g);
-
        let oid = crate::git::Oid::from_sha1(bytes);
-

-
        RepoId::from(oid)
-
    }
-
}
-

impl Arbitrary for AddressType {
    fn arbitrary(g: &mut qcheck::Gen) -> Self {
        let t = *g.choose(&[1, 2, 3, 4]).unwrap() as u8;