rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 heartwoode7419bf93616b654c220333525277018cc7e9517
{
"request": "trigger",
"version": 1,
"event_type": "patch",
"repository": {
"id": "rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5",
"name": "heartwood",
"description": "Radicle Heartwood Protocol & Stack",
"private": false,
"default_branch": "master",
"delegates": [
"did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT",
"did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz"
]
},
"action": "Created",
"patch": {
"id": "aaa6bfed7b17a4c114871f9818a3b00962eb0ec9",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"title": "radicle: custom upstream remote for patches",
"state": {
"status": "merged",
"conflicts": []
},
"before": "4b65c22305ddabf9bef331a372971e0c81e0de74",
"after": "e7419bf93616b654c220333525277018cc7e9517",
"commits": [
"e7419bf93616b654c220333525277018cc7e9517"
],
"target": "3fc92f83fe089263c470b328414d923227cf0e4a",
"labels": [],
"assignees": [],
"revisions": [
{
"id": "aaa6bfed7b17a4c114871f9818a3b00962eb0ec9",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "When creating a new upstream for the patch workflow, the remote name is always\nassumed to be `rad`.\n\nIt's possible for users to use another remote name but still use a `rad://` URL\nfor pushing. To allow for this, the function that creates the upstream entry now\ntakes a remote name. In the remote helper, `rad patch checkout`, and `rad patch\nset` the remote can be optionally specified and fall back to the `rad` remote\nname as a default.",
"base": "4b65c22305ddabf9bef331a372971e0c81e0de74",
"oid": "e7419bf93616b654c220333525277018cc7e9517",
"timestamp": 1720094001
},
{
"id": "24cb207738ab789beaeda3b026dc95a0b7464d21",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Rebase.",
"base": "00639182a7b7466f9d86486f521b26002f9bc682",
"oid": "e130b4dc06ca02a035519e1ea86ffeafc788866f",
"timestamp": 1726156855
}
]
}
}
{
"response": "triggered",
"run_id": {
"id": "3084d454-366b-49a7-956a-66b376f70aa1"
},
"info_url": "https://cci.rad.levitte.org//3084d454-366b-49a7-956a-66b376f70aa1.html"
}
Started at: 2026-09-08 02:22:43.204448+02:00
Commands:
$ rad clone rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 .
✓ Creating checkout in ./...
✓ Remote cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT added
✓ Remote-tracking branch cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/master created for z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT
✓ Remote fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM added
✓ Remote-tracking branch fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM/master created for z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM
✓ Remote lorenz@z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz added
✓ Remote-tracking branch lorenz@z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz/master created for z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz
✓ Repository successfully cloned under /opt/radcis/ci.rad.levitte.org/cci/state/3084d454-366b-49a7-956a-66b376f70aa1/w/
╭────────────────────────────────────╮
│ heartwood │
│ Radicle Heartwood Protocol & Stack │
│ 189 issues · 38 patches │
╰────────────────────────────────────╯
Run `cd ./.` to go to the repository directory.
Exit code: 0
$ rad patch checkout aaa6bfed7b17a4c114871f9818a3b00962eb0ec9
✓ Switched to branch patch/aaa6bfe at revision aaa6bfe
✓ Branch patch/aaa6bfe setup to track rad/patches/aaa6bfed7b17a4c114871f9818a3b00962eb0ec9
Exit code: 0
$ git config advice.detachedHead false
Exit code: 0
$ git checkout e7419bf93616b654c220333525277018cc7e9517
HEAD is now at e7419bf9 radicle: custom upstream remote for patches
Exit code: 0
$ rad patch show aaa6bfed7b17a4c114871f9818a3b00962eb0ec9 -p
╭──────────────────────────────────────────────────────────────────────────────────╮
│ Title radicle: custom upstream remote for patches │
│ Patch aaa6bfed7b17a4c114871f9818a3b00962eb0ec9 │
│ Author fintohaps z6Mkire…SQZ3voM │
│ Head e7419bf93616b654c220333525277018cc7e9517 │
│ Base 4b65c22305ddabf9bef331a372971e0c81e0de74 │
│ Target master │
│ Branches patch/aaa6bfe │
│ Commits ahead 1, behind 1264 │
│ Status merged │
│ │
│ When creating a new upstream for the patch workflow, the remote name is always │
│ assumed to be `rad`. │
│ │
│ It's possible for users to use another remote name but still use a `rad://` URL │
│ for pushing. To allow for this, the function that creates the upstream entry now │
│ takes a remote name. In the remote helper, `rad patch checkout`, and `rad patch │
│ set` the remote can be optionally specified and fall back to the `rad` remote │
│ name as a default. │
├──────────────────────────────────────────────────────────────────────────────────┤
│ e7419bf radicle: custom upstream remote for patches │
├──────────────────────────────────────────────────────────────────────────────────┤
│ ● Revision aaa6bfe @ 4b65c22..e7419bf by fintohaps z6Mkire…SQZ3voM 2 years ago │
│ ↑ Revision 24cb207 @ 0063918..e130b4d by cloudhead z6MksFq…bS9wzpT 1 year ago │
│ └─ ✓ merged by cloudhead z6MksFq…bS9wzpT │
╰──────────────────────────────────────────────────────────────────────────────────╯
commit e7419bf93616b654c220333525277018cc7e9517
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Thu Jul 4 11:37:04 2024 +0100
radicle: custom upstream remote for patches
When creating a new upstream for the patch workflow, the remote name is always
assumed to be `rad`.
It's possible for users to use another remote name but still use a `rad://` URL
for pushing. To allow for this, the function that creates the upstream entry now
takes a remote name. In the remote helper, `rad patch checkout`, and `rad patch
set` the remote can be optionally specified and fall back to the `rad` remote
name as a default.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
diff --git a/radicle-cli/src/commands/patch.rs b/radicle-cli/src/commands/patch.rs
index ce38d9218..bf54a7e3e 100644
--- a/radicle-cli/src/commands/patch.rs
+++ b/radicle-cli/src/commands/patch.rs
@@ -38,6 +38,7 @@ use anyhow::anyhow;
use radicle::cob::patch::PatchId;
use radicle::cob::{patch, Label};
+use radicle::git::RefString;
use radicle::patch::cache::Patches as _;
use radicle::storage::git::transport;
use radicle::{prelude::*, Node};
@@ -155,8 +156,13 @@ Checkout options
--revision <id> Checkout the given revision of the patch
--name <string> Provide a name for the branch to checkout
+ --remote <string> Provide the git remote to use as the upstream
-f, --force Checkout the head of the revision, even if the branch already exists
+Set options
+
+ --remote <string> Provide the git remote to use as the upstream
+
Other options
--repo <rid> Operate on the given repository (default: cwd)
@@ -269,6 +275,7 @@ pub enum Operation {
},
Set {
patch_id: Rev,
+ remote: Option<RefString>,
},
Cache {
patch_id: Option<Rev>,
@@ -332,6 +339,7 @@ impl Args for Options {
let mut undo = false;
let mut reply_to: Option<Rev> = None;
let mut checkout_opts = checkout::Options::default();
+ let mut remote: Option<RefString> = None;
let mut assign_opts = AssignOptions::default();
let mut label_opts = LabelOptions::default();
let mut review_op = review::Operation::default();
@@ -495,6 +503,11 @@ impl Args for Options {
checkout_opts.name = Some(term::args::refstring("name", val)?);
}
+ Long("remote") if op == Some(OperationName::Checkout) => {
+ let val = parser.value()?;
+ checkout_opts.remote = Some(term::args::refstring("remote", val)?);
+ }
+
// Assign options.
Short('a') | Long("add") if matches!(op, Some(OperationName::Assign)) => {
assign_opts.add.insert(term::args::did(&parser.value()?)?);
@@ -523,6 +536,12 @@ impl Args for Options {
label_opts.delete.insert(label);
}
+ // Set options.
+ Long("remote") if op == Some(OperationName::Set) => {
+ let val = parser.value()?;
+ remote = Some(term::args::refstring("remote", val)?);
+ }
+
// List options.
Long("all") => {
filter = None;
@@ -690,6 +709,7 @@ impl Args for Options {
},
OperationName::Set => Operation::Set {
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
+ remote,
},
OperationName::Cache => Operation::Cache { patch_id },
};
@@ -897,7 +917,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let patch_id = patch_id.resolve(&repository.backend)?;
label::run(&patch_id, add, delete, &profile, &repository)?;
}
- Operation::Set { patch_id } => {
+ Operation::Set { patch_id, remote } => {
let patches = profile.patches(&repository)?;
let patch_id = patch_id.resolve(&repository.backend)?;
let patch = patches
@@ -906,7 +926,13 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let workdir = workdir.ok_or(anyhow!(
"this command must be run from a repository checkout"
))?;
- radicle::rad::setup_patch_upstream(&patch_id, *patch.head(), &workdir, true)?;
+ radicle::rad::setup_patch_upstream(
+ &patch_id,
+ *patch.head(),
+ &workdir,
+ remote.as_ref().unwrap_or(&radicle::rad::REMOTE_NAME),
+ true,
+ )?;
}
Operation::Cache { patch_id } => {
let patch_id = patch_id
diff --git a/radicle-cli/src/commands/patch/checkout.rs b/radicle-cli/src/commands/patch/checkout.rs
index 748f6b17c..f5f776712 100644
--- a/radicle-cli/src/commands/patch/checkout.rs
+++ b/radicle-cli/src/commands/patch/checkout.rs
@@ -14,6 +14,7 @@ use crate::terminal as term;
#[derive(Debug, Default)]
pub struct Options {
pub name: Option<RefString>,
+ pub remote: Option<RefString>,
pub force: bool,
}
@@ -97,7 +98,13 @@ pub fn run(
));
spinner.finish();
- if let Some(branch) = rad::setup_patch_upstream(patch_id, revision.head(), working, false)? {
+ if let Some(branch) = rad::setup_patch_upstream(
+ patch_id,
+ revision.head(),
+ working,
+ opts.remote.as_ref().unwrap_or(&radicle::rad::REMOTE_NAME),
+ false,
+ )? {
let tracking = branch
.name()?
.ok_or_else(|| anyhow!("failed to create tracking branch: invalid name"))?;
diff --git a/radicle-remote-helper/src/lib.rs b/radicle-remote-helper/src/lib.rs
index 165a27e10..62748fb65 100644
--- a/radicle-remote-helper/src/lib.rs
+++ b/radicle-remote-helper/src/lib.rs
@@ -90,18 +90,18 @@ pub fn run(profile: radicle::Profile) -> Result<(), Error> {
// module is aware of that.
cli::Paint::set_terminal(io::stderr());
- let url: Url = {
+ let (remote, url): (Option<git::RefString>, Url) = {
let args = env::args().skip(1).take(2).collect::<Vec<_>>();
match args.as_slice() {
- [url] => url.parse(),
- [_, url] => url.parse(),
+ [url] => (None, url.parse()?),
+ [remote, url] => (git::RefString::try_from(remote.as_str()).ok(), url.parse()?),
_ => {
return Err(Error::InvalidArguments(args));
}
}
- }?;
+ };
let stored = profile.storage.repository_mut(url.repo)?;
if stored.is_empty()? {
@@ -174,6 +174,8 @@ pub fn run(profile: radicle::Profile) -> Result<(), Error> {
return push::run(
vec![refspec.to_string()],
&working,
+ // N.b. assume the default remote if there was no remote
+ remote.unwrap_or((*radicle::rad::REMOTE_NAME).clone()),
url,
&stored,
&profile,
diff --git a/radicle-remote-helper/src/push.rs b/radicle-remote-helper/src/push.rs
index d2bb13f4e..b9cf4b7ee 100644
--- a/radicle-remote-helper/src/push.rs
+++ b/radicle-remote-helper/src/push.rs
@@ -156,6 +156,7 @@ impl FromStr for Command {
pub fn run(
mut specs: Vec<String>,
working: &Path,
+ remote: git::RefString,
url: Url,
stored: &storage::git::Repository,
profile: &Profile,
@@ -222,6 +223,7 @@ pub fn run(
if dst == &*rad::PATCHES_REFNAME {
patch_open(
src,
+ &remote,
&nid,
&working,
stored,
@@ -376,6 +378,7 @@ pub fn run(
/// Open a new patch.
fn patch_open<G: Signer>(
src: &git::RefStr,
+ upstream: &git::RefString,
nid: &NodeId,
working: &git::raw::Repository,
stored: &storage::git::Repository,
@@ -463,7 +466,7 @@ fn patch_open<G: Signer>(
// Setup current branch so that pushing updates the patch.
if let Some(branch) =
- rad::setup_patch_upstream(&patch, commit.id().into(), working, false)?
+ rad::setup_patch_upstream(&patch, commit.id().into(), working, upstream, false)?
{
if let Some(name) = branch.name()? {
if profile.hints() {
diff --git a/radicle/src/rad.rs b/radicle/src/rad.rs
index 889a897b7..706b42d48 100644
--- a/radicle/src/rad.rs
+++ b/radicle/src/rad.rs
@@ -339,6 +339,7 @@ pub fn setup_patch_upstream<'a>(
patch: &ObjectId,
patch_head: git::Oid,
working: &'a git::raw::Repository,
+ remote: &git::RefString,
force: bool,
) -> Result<Option<git::raw::Branch<'a>>, git::ext::Error> {
let head = working.head()?;
@@ -370,12 +371,7 @@ pub fn setup_patch_upstream<'a>(
if let Some(name) = name {
if force || branch.upstream().is_err() {
- git::set_upstream(
- working,
- &*REMOTE_NAME,
- name.as_str(),
- git::refs::patch(patch),
- )?;
+ git::set_upstream(working, remote, name.as_str(), git::refs::patch(patch))?;
}
}
Ok(Some(git::raw::Branch::wrap(remote_branch)))
Exit code: 0
shell: 'cargo --version rustc --version cargo fmt --check cargo clippy --all-targets --workspace -- --deny clippy::all cargo build --all-targets --workspace cargo doc --workspace cargo test --workspace --no-fail-fast '
Commands:
$ podman run --name 3084d454-366b-49a7-956a-66b376f70aa1 -v /opt/radcis/ci.rad.levitte.org/cci/state/3084d454-366b-49a7-956a-66b376f70aa1/s:/3084d454-366b-49a7-956a-66b376f70aa1/s:ro -v /opt/radcis/ci.rad.levitte.org/cci/state/3084d454-366b-49a7-956a-66b376f70aa1/w:/3084d454-366b-49a7-956a-66b376f70aa1/w -w /3084d454-366b-49a7-956a-66b376f70aa1/w -v /opt/radcis/ci.rad.levitte.org/.radicle:/${id}/.radicle:ro -e RAD_HOME=/${id}/.radicle rust:trixie bash /3084d454-366b-49a7-956a-66b376f70aa1/s/script.sh
+ cargo --version
info: syncing channel updates for '1.77-x86_64-unknown-linux-gnu'
info: latest update on 2024-04-09, rust version 1.77.2 (25ef9e3d8 2024-04-09)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-std'
info: installing component 'rustc'
cargo 1.77.2 (e52e36006 2024-03-26)
+ rustc --version
rustc 1.77.2 (25ef9e3d8 2024-04-09)
+ cargo fmt --check
error: 'cargo-fmt' is not installed for the toolchain '1.77-x86_64-unknown-linux-gnu'.
To install, run `rustup component add --toolchain 1.77-x86_64-unknown-linux-gnu rustfmt`
Exit code: 1
{
"response": "finished",
"result": "failure"
}