Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Various small improvements across crates
cloudhead committed 2 years ago
commit 98c94de5e3db8acb55433ffd95f137396cde6fe4
parent bb06663d1c9388479c1638624e293a19fceaba22
7 files changed +43 -22
modified radicle-crypto/src/lib.rs
@@ -355,6 +355,11 @@ impl PublicKey {
    }

    #[cfg(feature = "radicle-git-ext")]
+
    pub fn to_component(&self) -> radicle_git_ext::ref_format::Component {
+
        radicle_git_ext::ref_format::Component::from(self)
+
    }
+

+
    #[cfg(feature = "radicle-git-ext")]
    pub fn from_namespaced(
        refstr: &radicle_git_ext::ref_format::Namespaced,
    ) -> Result<Self, PublicKeyError> {
modified radicle-node/src/runtime.rs
@@ -240,14 +240,6 @@ impl Runtime {
        }
        let reactor = Reactor::named(wire, popol::Poller::new(), thread::name(&id, "service"))?;
        let handle = Handle::new(home.clone(), reactor.controller(), emitter);
-
        let atomic = git::version()? >= git::VERSION_REQUIRED;
-

-
        if !atomic {
-
            log::warn!(
-
                target: "node",
-
                "Disabling atomic fetches; git version >= {} required", git::VERSION_REQUIRED
-
            );
-
        }

        let nid = *signer.public_key();
        let fetch = worker::FetchConfig {
modified radicle-node/src/test/environment.rs
@@ -476,10 +476,7 @@ impl<G: cyphernet::Ecdh<Pk = NodeId> + Signer + Clone> Node<G> {
        .map(|(id, _, _)| id)
        .unwrap();

-
        assert!(self
-
            .policies
-
            .seed(&id, node::policy::Scope::Followed)
-
            .unwrap());
+
        assert!(self.policies.seed(&id, node::policy::Scope::All).unwrap());

        log::debug!(
            target: "test",
modified radicle/src/cob/issue.rs
@@ -688,7 +688,7 @@ impl IssueCounts {
    }
}

-
impl<'a, R: WriteRepository> Issues<'a, R>
+
impl<'a, R> Issues<'a, R>
where
    R: ReadRepository + cob::Store,
{
@@ -699,7 +699,12 @@ where

        Ok(Self { raw })
    }
+
}

+
impl<'a, R> Issues<'a, R>
+
where
+
    R: WriteRepository + cob::Store,
+
{
    /// Get an issue.
    pub fn get(&self, id: &ObjectId) -> Result<Option<Issue>, store::Error> {
        self.raw.get(id)
modified radicle/src/cob/patch.rs
@@ -2241,7 +2241,7 @@ impl<'a, R> Deref for Patches<'a, R> {

impl<'a, R> Patches<'a, R>
where
-
    R: ReadRepository + cob::Store + 'static,
+
    R: ReadRepository + cob::Store,
{
    /// Open a patches store.
    pub fn open(repository: &'a R) -> Result<Self, RepositoryError> {
modified radicle/src/node.rs
@@ -659,7 +659,7 @@ impl FetchResult {
        }
    }

-
    pub fn find_updated(&self, name: &git::RefString) -> Option<RefUpdate> {
+
    pub fn find_updated(&self, name: &git::RefStr) -> Option<RefUpdate> {
        let updated = match self {
            Self::Success { updated, .. } => Some(updated),
            _ => None,
modified radicle/src/storage.rs
@@ -17,7 +17,7 @@ pub use radicle_git_ext::Oid;
use crate::cob;
use crate::collections::RandomMap;
use crate::git::ext as git_ext;
-
use crate::git::{refspec::Refspec, PatternString, Qualified, RefError, RefString};
+
use crate::git::{refspec::Refspec, PatternString, Qualified, RefError, RefStr, RefString};
use crate::identity::{Did, PayloadError};
use crate::identity::{Doc, DocAt, DocError};
use crate::identity::{Identity, RepoId};
@@ -186,12 +186,34 @@ impl RefUpdate {
        }
    }

-
    pub fn name(&self) -> &RefString {
-
        match &self {
-
            RefUpdate::Updated { name, .. } => name,
-
            RefUpdate::Created { name, .. } => name,
-
            RefUpdate::Deleted { name, .. } => name,
-
            RefUpdate::Skipped { name, .. } => name,
+
    /// Get the old OID, if any.
+
    pub fn old(&self) -> Option<Oid> {
+
        match self {
+
            RefUpdate::Updated { old, .. } => Some(*old),
+
            RefUpdate::Created { .. } => None,
+
            RefUpdate::Deleted { oid, .. } => Some(*oid),
+
            RefUpdate::Skipped { oid, .. } => Some(*oid),
+
        }
+
    }
+

+
    /// Get the new OID, if any.
+
    #[allow(clippy::new_ret_no_self)]
+
    pub fn new(&self) -> Option<Oid> {
+
        match self {
+
            RefUpdate::Updated { new, .. } => Some(*new),
+
            RefUpdate::Created { oid, .. } => Some(*oid),
+
            RefUpdate::Deleted { .. } => None,
+
            RefUpdate::Skipped { .. } => None,
+
        }
+
    }
+

+
    /// Get the ref name.
+
    pub fn name(&self) -> &RefStr {
+
        match self {
+
            RefUpdate::Updated { name, .. } => name.as_refstr(),
+
            RefUpdate::Created { name, .. } => name.as_refstr(),
+
            RefUpdate::Deleted { name, .. } => name.as_refstr(),
+
            RefUpdate::Skipped { name, .. } => name.as_refstr(),
        }
    }
}