tools: Add tool to set canonical refs

It's possible to delete these refs, or for old repos not to have them.
This commit is contained in:
Alexis Sellier 2023-04-17 22:10:20 +02:00
parent f41f092778
commit b2f9ca61d5
No known key found for this signature in database
2 changed files with 25 additions and 0 deletions

View File

@ -29,6 +29,10 @@ path = "src/rad-auth.rs"
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"

View File

@ -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(())
}