radicle-cli: Add labels column to patch list

This commit is contained in:
Adrian Duke 2026-06-05 14:14:11 +01:00 committed by Fintan Halpenny
parent fda165ffca
commit d734d69269
10 changed files with 69 additions and 60 deletions

View File

@ -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,

View File

@ -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.

View File

@ -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.

View File

@ -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
╰─────────────────────────────────────────────────────────────────────────────────────
```

View File

@ -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

View File

@ -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.

View File

@ -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:

View File

@ -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!

View File

@ -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 │

View File

@ -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::<Vec<_>>();
let mut labels = patch.labels().map(|t| t.to_string()).collect::<Vec<_>>();
labels.sort();
Ok([
match state {
@ -157,5 +160,6 @@ pub fn row(
.dim()
.italic()
.into(),
term::format::secondary(labels.join(", ")).into(),
])
}