Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
tools: Add tool to set canonical refs
Alexis Sellier committed 3 years ago
commit b2f9ca61d554926c7700bda0dfcbb710ff042a54
parent f41f0927784ad5f76a9699e0e35c643eed0b643b
2 files changed +25 -0
modified radicle-tools/Cargo.toml
@@ -30,6 +30,10 @@ name = "rad-self"
path = "src/rad-self.rs"

[[bin]]
+
name = "rad-set-canonical-refs"
+
path = "src/rad-set-canonical-refs.rs"
+

+
[[bin]]
name = "rad-push"
path = "src/rad-push.rs"

added radicle-tools/src/rad-set-canonical-refs.rs
@@ -0,0 +1,21 @@
+
use std::path::Path;
+

+
use radicle::{
+
    storage::{WriteRepository, WriteStorage},
+
    Profile,
+
};
+

+
fn main() -> anyhow::Result<()> {
+
    let profile = Profile::load()?;
+

+
    let (_, rid) = radicle::rad::repo(Path::new("."))?;
+
    let repo = profile.storage.repository_mut(rid)?;
+

+
    let id_oid = repo.set_identity_head()?;
+
    let branch_oid = repo.set_head()?;
+

+
    println!("ok: identity: {id_oid}");
+
    println!("ok: branch: {branch_oid}");
+

+
    Ok(())
+
}