Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
tools: Announce refs on push
Alexis Sellier committed 3 years ago
commit a20d16fc319dbbe35d8d407578c3b7577d86e800
parent c991c0eea00996250aa7c60595b6e9d41d8a75b8
2 files changed +6 -10
modified radicle-tools/src/rad-push.rs
@@ -1,6 +1,6 @@
use std::path::Path;

-
use radicle::storage::WriteStorage;
+
use radicle::{node::Handle, storage::WriteStorage};

fn main() -> anyhow::Result<()> {
    let cwd = Path::new(".").canonicalize()?;
@@ -13,6 +13,8 @@ fn main() -> anyhow::Result<()> {

    let project = profile.storage.repository(&id)?;
    let sigrefs = profile.storage.sign_refs(&project, &profile.signer)?;
+
    profile.node()?.announce_refs(&id)?;
+

    println!("ok: {}", sigrefs.signature);

    Ok(())
modified radicle/src/profile.rs
@@ -39,7 +39,6 @@ pub struct Profile {
    pub home: PathBuf,
    pub signer: UnsafeSigner,
    pub storage: Storage,
-
    pub node: Option<node::Connection>,
}

impl Profile {
@@ -59,7 +58,6 @@ impl Profile {
            home,
            signer,
            storage,
-
            node: None,
        })
    }

@@ -73,16 +71,12 @@ impl Profile {
            home,
            signer,
            storage,
-
            node: None,
        })
    }

-
    /// Connect to the local radicle node.
-
    pub fn connect(&mut self) -> Result<(), io::Error> {
-
        let conn = node::Connection::connect(self.socket())?;
-
        self.node = Some(conn);
-

-
        Ok(())
+
    /// Return a connection to the locally running node.
+
    pub fn node(&self) -> Result<node::Connection, io::Error> {
+
        node::Connection::connect(self.socket())
    }

    pub fn id(&self) -> &PublicKey {