From ee9ee691306a8accc627a00835a3116e9d235814 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Fri, 1 Dec 2023 12:02:38 +0000 Subject: [PATCH] cli: move rad review to rad patch It is more natural for the review command to exist as a subcommand of patch, since the reviews are for patches. Remove the `rad review` command, moving its functionality to the `rad patch` command. The rad-patch.md and rad-review-by-hunk.md tests are modified to use the `rad patch review` command. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-cli/examples/rad-patch.md | 2 +- radicle-cli/examples/rad-review-by-hunk.md | 14 +- radicle-cli/src/commands.rs | 2 - radicle-cli/src/commands/help.rs | 1 - radicle-cli/src/commands/patch.rs | 104 ++++++ radicle-cli/src/commands/patch/review.rs | 141 +++++++++ .../commands/{ => patch}/review/builder.rs | 0 radicle-cli/src/commands/review.rs | 299 ------------------ radicle-cli/src/main.rs | 7 - 9 files changed, 253 insertions(+), 317 deletions(-) create mode 100644 radicle-cli/src/commands/patch/review.rs rename radicle-cli/src/commands/{ => patch}/review/builder.rs (100%) delete mode 100644 radicle-cli/src/commands/review.rs diff --git a/radicle-cli/examples/rad-patch.md b/radicle-cli/examples/rad-patch.md index 896675c1..64223e82 100644 --- a/radicle-cli/examples/rad-patch.md +++ b/radicle-cli/examples/rad-patch.md @@ -154,7 +154,7 @@ $ rad patch checkout 6ff4f09 We can also add a review verdict as such: ``` -$ rad review 6ff4f09 --accept --no-message --no-sync +$ rad patch review 6ff4f09 --accept --no-message ✓ Patch 6ff4f09 accepted ``` diff --git a/radicle-cli/examples/rad-review-by-hunk.md b/radicle-cli/examples/rad-review-by-hunk.md index 047cbcc8..53117104 100644 --- a/radicle-cli/examples/rad-review-by-hunk.md +++ b/radicle-cli/examples/rad-review-by-hunk.md @@ -70,7 +70,7 @@ Finally, we do a review of the patch by hunk. The output of this command should match `git diff master -W100% -U5 --patience`: ``` -$ rad review --no-sync --patch -U5 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch -U5 52da8356aa9beec08e6943cb3c4063fa37f3241b diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7937fb3..0000000 @@ -116,7 +116,7 @@ rename to notes/INSTRUCTIONS.txt Now let's accept these hunks one by one.. ``` -$ rad review --no-sync --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b ✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b diff --git a/.gitignore b/.gitignore deleted file mode 100644 @@ -127,7 +127,7 @@ index 7937fb3..0000000 -*.draft ``` ``` -$ rad review --no-sync --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b ✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b diff --git a/DISCLAIMER.txt b/DISCLAIMER.txt new file mode 100644 @@ -138,7 +138,7 @@ index 0000000..2b5bd86 +All food is served as-is, with no warranty! ``` ``` -$ rad review --no-sync --patch --accept -U3 --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept -U3 --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b ✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b diff --git a/MENU.txt b/MENU.txt index 867958c..3af9741 100644 @@ -153,7 +153,7 @@ index 867958c..3af9741 100644 [..] ``` ``` -$ rad review --no-sync --patch --accept -U3 --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept -U3 --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b ✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b diff --git a/MENU.txt b/MENU.txt index 4e2e828..3af9741 100644 @@ -169,7 +169,7 @@ index 4e2e828..3af9741 100644 ``` ``` -$ rad review --no-sync --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b ✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b diff --git a/INSTRUCTIONS.txt b/notes/INSTRUCTIONS.txt similarity index 100% @@ -178,7 +178,7 @@ rename to notes/INSTRUCTIONS.txt ``` ``` -$ rad review --no-sync --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b ✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b ✓ All hunks have been reviewed ``` diff --git a/radicle-cli/src/commands.rs b/radicle-cli/src/commands.rs index c1c74d12..0deabc29 100644 --- a/radicle-cli/src/commands.rs +++ b/radicle-cli/src/commands.rs @@ -36,8 +36,6 @@ pub mod rad_path; pub mod rad_publish; #[path = "commands/remote.rs"] pub mod rad_remote; -#[path = "commands/review.rs"] -pub mod rad_review; #[path = "commands/self.rs"] pub mod rad_self; #[path = "commands/sync.rs"] diff --git a/radicle-cli/src/commands/help.rs b/radicle-cli/src/commands/help.rs index 7a99e3fc..41efe4e6 100644 --- a/radicle-cli/src/commands/help.rs +++ b/radicle-cli/src/commands/help.rs @@ -26,7 +26,6 @@ const COMMANDS: &[Help] = &[ rad_node::HELP, rad_patch::HELP, rad_path::HELP, - rad_review::HELP, rad_clean::HELP, rad_self::HELP, rad_track::HELP, diff --git a/radicle-cli/src/commands/patch.rs b/radicle-cli/src/commands/patch.rs index 637165c8..e6599f61 100644 --- a/radicle-cli/src/commands/patch.rs +++ b/radicle-cli/src/commands/patch.rs @@ -20,6 +20,8 @@ mod list; mod ready; #[path = "patch/redact.rs"] mod redact; +#[path = "patch/review.rs"] +mod review; #[path = "patch/show.rs"] mod show; #[path = "patch/update.rs"] @@ -53,6 +55,7 @@ Usage rad patch archive [