diff --git a/CHANGELOG.md b/CHANGELOG.md index 745729d1..674858b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## Improvements + +- `rad patch list` includes a `Labels` column, showing any assigned labels to + the patch. + ## Fixed Bugs - Previously, a delegate could push to the default branch, for the first time, diff --git a/crates/radicle-cli/examples/rad-cob-log.md b/crates/radicle-cli/examples/rad-cob-log.md index 58b42ca8..29fb48bc 100644 --- a/crates/radicle-cli/examples/rad-cob-log.md +++ b/crates/radicle-cli/examples/rad-cob-log.md @@ -42,11 +42,11 @@ Patch can be listed. ``` $ rad patch -╭─────────────────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├─────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● aa45913 Define power requirements alice (you) - 3e674d1 +0 -0 now │ -╰─────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├─────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ● aa45913 Define power requirements alice (you) - 3e674d1 +0 -0 now │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ``` Both issue and patch COBs can be listed. diff --git a/crates/radicle-cli/examples/rad-cob-show.md b/crates/radicle-cli/examples/rad-cob-show.md index 673f8878..f5d0420d 100644 --- a/crates/radicle-cli/examples/rad-cob-show.md +++ b/crates/radicle-cli/examples/rad-cob-show.md @@ -45,11 +45,11 @@ Patch can be listed. ``` $ rad patch -╭───────────────────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├───────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● d1f7f86 Start drafting peace treaty alice (you) - 575ed68 +0 -0 now │ -╰───────────────────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├───────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ● d1f7f86 Start drafting peace treaty alice (you) - 575ed68 +0 -0 now │ +╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ``` Both issue and patch COBs can be listed. diff --git a/crates/radicle-cli/examples/rad-merge-via-push.md b/crates/radicle-cli/examples/rad-merge-via-push.md index 5a82f3f9..65930037 100644 --- a/crates/radicle-cli/examples/rad-merge-via-push.md +++ b/crates/radicle-cli/examples/rad-merge-via-push.md @@ -76,12 +76,12 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE ``` ``` $ rad patch --merged -╭─────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├─────────────────────────────────────────────────────────────────────────────┤ -│ ✓ [ ... ] Second change alice (you) - daf349f +0 -0 now │ -│ ✓ [ ... ] First change alice (you) - 20aa5dd +0 -0 now │ -╰─────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├─────────────────────────────────────────────────────────────────────────────────────┤ +│ ✓ [ ... ] Second change alice (you) - daf349f +0 -0 now │ +│ ✓ [ ... ] First change alice (you) - 20aa5dd +0 -0 now │ +╰─────────────────────────────────────────────────────────────────────────────────────╯ $ rad patch show 696ec5508494692899337afe6713fe1796d0315c ╭──────────────────────────────────────────────────────────╮ │ Title First change │ @@ -156,10 +156,10 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE ``` ``` $ rad patch --all -╭─────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├─────────────────────────────────────────────────────────────────────────────┤ -│ ● 356f738 Second change alice (you) - daf349f +0 -0 now │ -│ ✓ 696ec55 First change alice (you) - 20aa5dd +0 -0 now │ -╰─────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├─────────────────────────────────────────────────────────────────────────────────────┤ +│ ● 356f738 Second change alice (you) - daf349f +0 -0 now │ +│ ✓ 696ec55 First change alice (you) - 20aa5dd +0 -0 now │ +╰─────────────────────────────────────────────────────────────────────────────────────╯ ``` diff --git a/crates/radicle-cli/examples/rad-patch-ahead-behind.md b/crates/radicle-cli/examples/rad-patch-ahead-behind.md index b64c206d..1081ae5e 100644 --- a/crates/radicle-cli/examples/rad-patch-ahead-behind.md +++ b/crates/radicle-cli/examples/rad-patch-ahead-behind.md @@ -45,11 +45,11 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE When listing, we see that it has one addition: ``` $ rad patch list -╭────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├────────────────────────────────────────────────────────────────────────┤ -│ ● 217f050 Add Alan alice (you) - 5c88a79 +1 -0 now │ -╰────────────────────────────────────────────────────────────────────────╯ +╭────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├────────────────────────────────────────────────────────────────────────────────┤ +│ ● 217f050 Add Alan alice (you) - 5c88a79 +1 -0 now │ +╰────────────────────────────────────────────────────────────────────────────────╯ ``` When showing the patch, we see that it is `ahead 1, behind 1`, since master has diff --git a/crates/radicle-cli/examples/rad-patch-jj.md b/crates/radicle-cli/examples/rad-patch-jj.md index 63011bc5..80ac30eb 100644 --- a/crates/radicle-cli/examples/rad-patch-jj.md +++ b/crates/radicle-cli/examples/rad-patch-jj.md @@ -47,11 +47,11 @@ 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 │ -╰─────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├─────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ● 1e31055 Define power requirements alice (you) - a6ea7b7 +0 -0 now │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ``` Let's also create a bookmark for it. diff --git a/crates/radicle-cli/examples/rad-patch-via-push.md b/crates/radicle-cli/examples/rad-patch-via-push.md index 73b16427..98c39891 100644 --- a/crates/radicle-cli/examples/rad-patch-via-push.md +++ b/crates/radicle-cli/examples/rad-patch-via-push.md @@ -97,12 +97,12 @@ And both patches: ``` $ rad patch -╭───────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├───────────────────────────────────────────────────────────────────────────────┤ -│ ● 6035d2f Add things #1 alice (you) - 42d894a +0 -0 now │ -│ ● 9580891 Add more things alice (you) - 8b0ea80 +0 -0 now │ -╰───────────────────────────────────────────────────────────────────────────────╯ +╭───────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├───────────────────────────────────────────────────────────────────────────────────────┤ +│ ● 6035d2f Add things #1 alice (you) - 42d894a +0 -0 now │ +│ ● 9580891 Add more things alice (you) - 8b0ea80 +0 -0 now │ +╰───────────────────────────────────────────────────────────────────────────────────────╯ ``` To update our patch, we simply push commits to the upstream branch: diff --git a/crates/radicle-cli/examples/rad-patch.md b/crates/radicle-cli/examples/rad-patch.md index 3e5c52e3..a68ff30c 100644 --- a/crates/radicle-cli/examples/rad-patch.md +++ b/crates/radicle-cli/examples/rad-patch.md @@ -35,11 +35,11 @@ It will now be listed as one of the project's open patches. ``` $ rad patch -╭─────────────────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├─────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● aa45913 Define power requirements alice (you) - 3e674d1 +0 -0 now │ -╰─────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├─────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ● aa45913 Define power requirements alice (you) - 3e674d1 +0 -0 now │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ``` ``` $ rad patch show aa45913e757cacd46972733bddee5472c78fa32a -p @@ -76,11 +76,11 @@ We can also list only patches that we've authored. ``` $ rad patch list --authored -╭─────────────────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├─────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● aa45913 Define power requirements alice (you) - 3e674d1 +0 -0 now │ -╰─────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├─────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ● aa45913 Define power requirements alice (you) - 3e674d1 +0 -0 now │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ``` We can also see that it set an upstream for our patch branch: @@ -206,11 +206,11 @@ $ rad patch show aa45913 │ └─ ✓ accepted by alice (you) now │ ╰──────────────────────────────────────────────────────────╯ $ rad patch list -╭─────────────────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├─────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● aa45913 Define power requirements alice (you) ✓ 27857ec +0 -0 now │ -╰─────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├─────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ● aa45913 Define power requirements alice (you) ✓ 27857ec +0 -0 now fun │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ``` If you make a mistake on the patch description, you can always change it! diff --git a/crates/radicle-cli/examples/workflow/4-patching-contributor.md b/crates/radicle-cli/examples/workflow/4-patching-contributor.md index c9038e30..32150846 100644 --- a/crates/radicle-cli/examples/workflow/4-patching-contributor.md +++ b/crates/radicle-cli/examples/workflow/4-patching-contributor.md @@ -35,11 +35,11 @@ It will now be listed as one of the project's open patches. ``` $ rad patch -╭─────────────────────────────────────────────────────────────────────────────────────────╮ -│ ● ID Title Author Reviews Head + - Updated │ -├─────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● e4934b6 Define power requirements bob (you) - 3e674d1 +0 -0 now │ -╰─────────────────────────────────────────────────────────────────────────────────────────╯ +╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ ● ID Title Author Reviews Head + - Updated Labels │ +├─────────────────────────────────────────────────────────────────────────────────────────────────┤ +│ ● e4934b6 Define power requirements bob (you) - 3e674d1 +0 -0 now │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ $ rad patch show e4934b6d9dbe01ce3c7fbb5b77a80d5f1dacdc46 ╭────────────────────────────────────────────────────────╮ │ Title Define power requirements │ diff --git a/crates/radicle-cli/src/commands/patch/list.rs b/crates/radicle-cli/src/commands/patch/list.rs index e97b774e..ef374b8a 100644 --- a/crates/radicle-cli/src/commands/patch/list.rs +++ b/crates/radicle-cli/src/commands/patch/list.rs @@ -50,7 +50,7 @@ pub fn run( return Ok(()); } - let mut table = Table::<10, term::Line>::new(TableOptions { + let mut table = Table::<11, term::Line>::new(TableOptions { spacing: 2, border: Some(term::colors::FAINT), ..TableOptions::default() @@ -67,6 +67,7 @@ pub fn run( term::format::bold(String::from("+")).into(), term::format::bold(String::from("-")).into(), term::format::bold(String::from("Updated")).into(), + term::format::bold(String::from("Labels")).into(), ]); table.divider(); @@ -104,7 +105,7 @@ pub fn row( patch: &Patch, repository: &Repository, profile: &Profile, -) -> anyhow::Result<[term::Line; 10]> { +) -> anyhow::Result<[term::Line; 11]> { let state = patch.state(); let (_, revision) = patch.latest(); let (from, to) = revision.range(); @@ -137,6 +138,8 @@ pub fn row( } }) .collect::>(); + let mut labels = patch.labels().map(|t| t.to_string()).collect::>(); + labels.sort(); Ok([ match state { @@ -157,5 +160,6 @@ pub fn row( .dim() .italic() .into(), + term::format::secondary(labels.join(", ")).into(), ]) }