Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cob: Remove direct dependency on `radicle-git-ext`
Lorenz Leutgeb committed 7 months ago
commit 96f9a9e9faf48f8e11133e65e62d7fd3e574cf7f
parent 8aa0a42a9fea64d6fada6e1943c21d7220b03880
15 files changed +45 -41
modified Cargo.lock
@@ -2880,7 +2880,8 @@ dependencies = [
 "qcheck-macros",
 "radicle-crypto",
 "radicle-dag",
-
 "radicle-git-ext",
+
 "radicle-git-ref-format",
+
 "radicle-git2-metadata",
 "radicle-oid",
 "serde",
 "serde_json",
modified crates/radicle-cob/Cargo.toml
@@ -26,8 +26,9 @@ log = { workspace = true }
nonempty = { workspace = true, features = ["serialize"] }
radicle-crypto = { workspace = true, features = ["ssh"] }
radicle-dag = { workspace = true }
+
radicle-git-ref-format = { workspace = true, features = ["macro"] }
+
radicle-git2-metadata = { workspace = true }
radicle-oid = { workspace = true, features = ["git2", "serde", "std"] }
-
radicle-git-ext = { workspace = true, features = ["serde"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
signature = { workspace = true }
@@ -39,4 +40,4 @@ qcheck = { workspace = true }
qcheck-macros = { workspace = true }
radicle-crypto = { workspace = true, features = ["test", "radicle-git-ext"] }
radicle-oid = { workspace = true, features = ["qcheck"] }
-
tempfile = { workspace = true }

\ No newline at end of file
+
tempfile = { workspace = true }
modified crates/radicle-cob/src/backend/git/change.rs
@@ -5,11 +5,11 @@ use std::convert::TryFrom;
use std::path::PathBuf;
use std::sync::LazyLock;

-
use git_ext::author::Author;
-
use git_ext::commit::{headers::Headers, Commit};
+
use metadata::author::Author;
+
use metadata::commit::trailers::OwnedTrailer;
+
use metadata::commit::{headers::Headers, Commit};
use nonempty::NonEmpty;
-
use radicle_git_ext::commit::trailers::OwnedTrailer;
-
use radicle_oid::Oid;
+
use oid::Oid;

use crate::change::store::Version;
use crate::signatures;
@@ -30,8 +30,8 @@ pub mod error {
    use std::str::Utf8Error;
    use std::string::FromUtf8Error;

-
    use git_ext::commit;
-
    use radicle_oid::Oid;
+
    use metadata::commit;
+
    use oid::Oid;
    use thiserror::Error;

    use crate::signatures::error::Signatures;
@@ -301,7 +301,7 @@ fn write_commit(
        let stable = crate::stable::read_timestamp();
        (
            Author {
-
                time: git_ext::author::Time::new(stable, 0),
+
                time: metadata::author::Time::new(stable, 0),
                ..author
            },
            stable,
@@ -315,7 +315,7 @@ fn write_commit(
            );
        };
        let author = Author {
-
            time: git_ext::author::Time::new(timestamp, 0),
+
            time: metadata::author::Time::new(timestamp, 0),
            ..author
        };
        (author, timestamp)
modified crates/radicle-cob/src/change_graph.rs
@@ -3,8 +3,8 @@
use std::ops::ControlFlow;
use std::{cmp::Ordering, collections::BTreeSet};

-
use radicle_dag::Dag;
-
use radicle_oid::Oid;
+
use dag::Dag;
+
use oid::Oid;

use crate::{
    change, object, object::collaboration::Evaluate, signatures::ExtendedSignature,
modified crates/radicle-cob/src/history.rs
@@ -2,8 +2,8 @@
#![allow(clippy::too_many_arguments)]
use std::{cmp::Ordering, collections::BTreeSet, ops::ControlFlow};

-
use radicle_dag::Dag;
-
use radicle_oid::Oid;
+
use dag::Dag;
+
use oid::Oid;

pub use crate::change::{Contents, Entry, EntryId, Timestamp};

modified crates/radicle-cob/src/lib.rs
@@ -60,7 +60,9 @@ extern crate qcheck;
extern crate qcheck_macros;

extern crate radicle_crypto as crypto;
-
extern crate radicle_git_ext as git_ext;
+
extern crate radicle_dag as dag;
+
extern crate radicle_git2_metadata as metadata;
+
extern crate radicle_git_ref_format as fmt;
extern crate radicle_oid as oid;

mod backend;
modified crates/radicle-cob/src/object.rs
@@ -1,9 +1,9 @@
// Copyright © 2022 The Radicle Link Contributors

-
use std::{convert::TryFrom as _, fmt, ops::Deref, str::FromStr};
+
use std::{convert::TryFrom as _, ops::Deref, str::FromStr};

-
use git_ext::ref_format::{Component, RefString};
-
use radicle_oid::Oid;
+
use fmt::{Component, RefString};
+
use oid::Oid;
use serde::{Deserialize, Serialize};
use thiserror::Error;

@@ -70,8 +70,8 @@ impl Deref for ObjectId {
    }
}

-
impl fmt::Display for ObjectId {
-
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+
impl std::fmt::Display for ObjectId {
+
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}
modified crates/radicle-cob/src/object/collaboration.rs
@@ -101,11 +101,11 @@ impl<R> Evaluate<R> for NonEmpty<Entry> {
/// [`TypeName`] and [`ObjectId`] from it.
///
/// This assumes that the `refname` is in a
-
/// [`git_ext::ref_format::Qualified`] format. If it has any
+
/// [`fmt::Qualified`] format. If it has any
/// `refs/namespaces`, they will be stripped to access the underlying
-
/// [`git_ext::ref_format::Qualified`] format.
+
/// [`fmt::Qualified`] format.
///
-
/// In the [`git_ext::ref_format::Qualified`] format it assumes that the
+
/// In the [`fmt::Qualified`] format it assumes that the
/// reference name is of the form:
///
///   `refs/<category>/<typename>/<object_id>[/<rest>*]`
@@ -115,14 +115,14 @@ impl<R> Evaluate<R> for NonEmpty<Entry> {
///
/// Also note that this will return `None` if:
///
-
///   * The `refname` is not [`git_ext::ref_format::Qualified`]
+
///   * The `refname` is not [`fmt::Qualified`]
///   * The parsing of the [`ObjectId`] fails
///   * The parsing of the [`TypeName`] fails
pub fn parse_refstr<R>(name: &R) -> Option<(TypeName, ObjectId)>
where
-
    R: AsRef<git_ext::ref_format::RefStr>,
+
    R: AsRef<fmt::RefStr>,
{
-
    use git_ext::ref_format::Qualified;
+
    use fmt::Qualified;
    let name = name.as_ref();
    let refs_cobs = match name.to_namespaced() {
        None => Qualified::from_refstr(name)?,
modified crates/radicle-cob/src/object/storage.rs
@@ -2,8 +2,8 @@

use std::{collections::BTreeMap, error::Error};

-
use git_ext::ref_format::RefString;
-
use radicle_oid::Oid;
+
use fmt::RefString;
+
use oid::Oid;

use crate::change::EntryId;
use crate::{ObjectId, TypeName};
@@ -93,7 +93,7 @@ pub trait Storage {
pub mod convert {
    use std::str;

-
    use git_ext::ref_format::RefString;
+
    use fmt::RefString;
    use thiserror::Error;

    #[derive(Debug, Error)]
@@ -106,7 +106,7 @@ pub mod convert {
            err: git2::Error,
        },
        #[error(transparent)]
-
        Ref(#[from] git_ext::ref_format::Error),
+
        Ref(#[from] fmt::Error),
        #[error(transparent)]
        Utf8(#[from] str::Utf8Error),
    }
modified crates/radicle-cob/src/signatures.rs
@@ -8,7 +8,7 @@ use std::{
};

use crypto::{ssh, PublicKey};
-
use git_ext::commit::{
+
use metadata::commit::{
    headers::Signature::{Pgp, Ssh},
    Commit,
};
modified crates/radicle-cob/src/signatures/error.rs
@@ -1,6 +1,6 @@
// Copyright © 2019-2020 The Radicle Foundation <hello@radicle.foundation>

-
use radicle_crypto::ssh::ExtendedSignatureError;
+
use crypto::ssh::ExtendedSignatureError;
use thiserror::Error;

#[derive(Debug, Error)]
modified crates/radicle-cob/src/test/storage.rs
@@ -1,6 +1,6 @@
use std::{collections::BTreeMap, convert::TryFrom as _};

-
use radicle_git_ext::ref_format::{refname, Component};
+
use fmt::{refname, Component};
use tempfile::TempDir;

use crate::{
@@ -29,7 +29,7 @@ pub mod error {
        #[error(transparent)]
        Git(#[from] git2::Error),
        #[error(transparent)]
-
        Format(#[from] git_ext::ref_format::Error),
+
        Format(#[from] fmt::Error),
    }
}

modified crates/radicle-cob/src/tests.rs
@@ -1,4 +1,4 @@
-
use git_ext::ref_format::{refname, Component, RefString};
+
use fmt::{refname, Component, RefString};

use crate::{object, test::arbitrary::Invalid, ObjectId, TypeName};

modified crates/radicle-cob/src/trailers.rs
@@ -1,6 +1,6 @@
// Copyright © 2019-2020 The Radicle Foundation <hello@radicle.foundation>

-
use git_ext::commit::trailers::{OwnedTrailer, Token, Trailer};
+
use metadata::commit::trailers::{OwnedTrailer, Token, Trailer};
use std::ops::Deref as _;

pub mod error {
modified crates/radicle-cob/src/type_name.rs
@@ -1,8 +1,8 @@
// Copyright © 2022 The Radicle Link Contributors

-
use std::{fmt, str::FromStr};
+
use std::str::FromStr;

-
use git_ext::ref_format::{Component, RefString};
+
use fmt::{Component, RefString};
use serde::{Deserialize, Serialize};
use thiserror::Error;

@@ -24,8 +24,8 @@ impl TypeName {
    }
}

-
impl fmt::Display for TypeName {
-
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+
impl std::fmt::Display for TypeName {
+
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(self.0.as_str())
    }
}