diff --git a/crates/radicle-cli/examples/jj-config.md b/crates/radicle-cli/examples/jj-config.md new file mode 100644 index 00000000..cc11e3a2 --- /dev/null +++ b/crates/radicle-cli/examples/jj-config.md @@ -0,0 +1,19 @@ +Let's make sure that the config is exactly what we expect. + +``` +$ jj config list +ui.editor = "true" +user.name = "Test User" +user.email = "test.user@example.com" +debug.commit-timestamp = "2001-02-03T04:05:06+07:00" +debug.randomness-seed = 0 +debug.operation-timestamp = "2001-02-03T04:05:06+07:00" +operation.hostname = "host.example.com" +operation.username = "test-username" +``` + +We enable writing Change ID headers to our commits. + +``` +$ jj config set --user git.write-change-id-header true +``` \ No newline at end of file diff --git a/crates/radicle-cli/examples/jj-init-colocate.md b/crates/radicle-cli/examples/jj-init-colocate.md new file mode 100644 index 00000000..8da7c473 --- /dev/null +++ b/crates/radicle-cli/examples/jj-init-colocate.md @@ -0,0 +1,10 @@ +We initialize Jujutusu for our repository by colocating with Git. + +```(stderr) +$ jj git init --colocate +Done importing changes from the underlying Git repo. +Hint: The following remote bookmarks aren't associated with the existing local bookmarks: + master@rad +Hint: Run `jj bookmark track master@rad` to keep local bookmarks updated on future pulls. +Initialized repo in "." +``` \ No newline at end of file diff --git a/crates/radicle-cli/examples/rad-patch-jj.md b/crates/radicle-cli/examples/rad-patch-jj.md new file mode 100644 index 00000000..b22e64c2 --- /dev/null +++ b/crates/radicle-cli/examples/rad-patch-jj.md @@ -0,0 +1,91 @@ +The scenario in this file is a variation of the one in `rad-patch.md`, +but uses Jujutsu. + +``` +$ touch REQUIREMENTS +$ jj describe --message "Define power requirements" +$ jj status +Working copy changes: +A REQUIREMENTS +Working copy (@) : lvxkkpmk a6ea7b72 Define power requirements +Parent commit (@-): xpnzuzwn f2de534b master master@rad | Second commit +``` + +``` +$ jj new +``` + +Just making sure that Git sees the Change ID… + +``` +$ git cat-file commit a6ea7b72 +tree [..] +parent f2de534b[..] +author Test User 981147906 +0700 +committer Test User 981147906 +0700 +change-id lvxkkpmk[..] + +Define power requirements +``` + +As of 2025-05 we can't use `jj` to do push with options directly, see: + + - + - + +However, since we initialized Jujutusu to colocate with Git, we can just use +Git to push. + +``` (stderr) +$ git push rad -o patch.message="Define power requirements" -o patch.message="See details." HEAD:refs/patches +✓ Patch 1e31055ed3c41a48f2a71ba5317feb863b089700 opened +To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi + * [new reference] HEAD -> refs/patches +``` + +It will now be listed as one of the open patches. + +``` +$ rad patch +╭─────────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated │ +├─────────────────────────────────────────────────────────────────────────────────────────┤ +│ ● 1e31055 Define power requirements alice (you) - a6ea7b7 +0 -0 now │ +╰─────────────────────────────────────────────────────────────────────────────────────────╯ +``` + +Let's also create a bookmark for it. + +``` +$ jj bookmark create flux-capacitor-power +``` + +``` +$ rad patch show 1e31055 -p +╭───────────────────────────────────────────────────╮ +│ Title Define power requirements │ +│ Patch 1e31055[.. ] │ +│ Author alice (you) │ +│ Head a6ea7b7[.. ] │ +│ Base f2de534[.. ] │ +│ Commits ahead 1, behind 0 │ +│ Status open │ +│ │ +│ See details. │ +├───────────────────────────────────────────────────┤ +│ a6ea7b7 Define power requirements │ +├───────────────────────────────────────────────────┤ +│ ● Revision 1e31055 @ a6ea7b7 by alice (you) now │ +╰───────────────────────────────────────────────────╯ + +commit a6ea7b7[..] +Author: Test User +Date: Sat Feb 3 04:05:06 2001 +0700 + + Define power requirements + +diff --git a/REQUIREMENTS b/REQUIREMENTS +new file mode 100644 +index 0000000..e69de29 + +``` \ No newline at end of file diff --git a/crates/radicle-cli/tests/commands.rs b/crates/radicle-cli/tests/commands.rs index 5ef3c0fb..ebbad389 100644 --- a/crates/radicle-cli/tests/commands.rs +++ b/crates/radicle-cli/tests/commands.rs @@ -858,6 +858,17 @@ fn rad_patch() { Environment::alice(["rad-init", "rad-patch"]); } +#[test] +fn rad_jj_colocated_patch() { + // We test whether `jj` is installed, and have this test succeed if it is not. + // Programmatic skipping of tests is not supported as of 2024-08. + if !program_reports_version("jj") { + return; + } + + Environment::alice(["rad-init", "jj-config", "jj-init-colocate", "rad-patch-jj"]) +} + #[test] fn rad_patch_diff() { Environment::alice(["rad-init", "rad-patch-diff"]);