Files
heartwood/crates/radicle-cli/examples/rad-patch-draft.md
T
Lorenz Leutgeb f9ff484c9e cli: Make rad patch show prettier
The output of this command is confusing. It is not clear which of the
hashes printed is that of the revision and which one is the respective
head commit.

Further, the hash is omitted on the initial revision, adding confusion.

Further, the terminology of "revised" vs. "updated" is confusing.

This rewrites `timeline.rs` to drop the distinction between various
revisions (in wording, the small icon is still different) and cleans up
the output.

Attention is paid to alignment of the output. Now all verbs of updates
("accepted", "rejected", "reviewed", "merged") are aligned, and authors
("… by …") are also aligned.

The rewrite itself is not for better code quality or readability.
Note that all the code in this file only accessed via one `fn` by one
callsite in the implementation of `rad patch`.
2025-09-16 11:37:13 +02:00

4.7 KiB

Let's say we have some changes in a branch:

$ git checkout -b cloudhead/draft
$ git commit -a -m "Nothing to see here.." -q --allow-empty

To open a patch in draft mode, we use the --draft option:

$ git push -o patch.draft -o patch.message="Nothing yet" rad HEAD:refs/patches
✓ Patch 97e18f8598237a396a1c0ac1509c89028e666c97 drafted
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
 * [new reference]   HEAD -> refs/patches

We can confirm it's a draft by running show:

$ rad patch show 97e18f8598237a396a1c0ac1509c89028e666c97
╭────────────────────────────────────────────────────╮
│ Title     Nothing yet                              │
│ Patch     97e18f8598237a396a1c0ac1509c89028e666c97 │
│ Author    alice (you)                              │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Base      [..                                    ] │
│ Branches  cloudhead/draft                          │
│ Commits   ahead 1, behind 0                        │
│ Status    draft                                    │
├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here..                      │
├────────────────────────────────────────────────────┤
│ ● Revision 97e18f8 @ 2a46583 by alice (you) now    │
╰────────────────────────────────────────────────────╯

Once the patch is ready for review, we can use the ready command:

$ rad patch ready 97e18f8598237a396a1c0ac1509c89028e666c97 --no-announce
$ rad patch show 97e18f8598237a396a1c0ac1509c89028e666c97
╭────────────────────────────────────────────────────╮
│ Title     Nothing yet                              │
│ Patch     97e18f8598237a396a1c0ac1509c89028e666c97 │
│ Author    alice (you)                              │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Base      [..                                    ] │
│ Branches  cloudhead/draft                          │
│ Commits   ahead 1, behind 0                        │
│ Status    open                                     │
├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here..                      │
├────────────────────────────────────────────────────┤
│ ● Revision 97e18f8 @ 2a46583 by alice (you) now    │
╰────────────────────────────────────────────────────╯

If for whatever reason, it needed to go back into draft mode, we could use the --undo flag:

$ rad patch ready --undo 97e18f8598237a396a1c0ac1509c89028e666c97 --no-announce
$ rad patch show 97e18f8598237a396a1c0ac1509c89028e666c97
╭────────────────────────────────────────────────────╮
│ Title     Nothing yet                              │
│ Patch     97e18f8598237a396a1c0ac1509c89028e666c97 │
│ Author    alice (you)                              │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Base      [..                                    ] │
│ Branches  cloudhead/draft                          │
│ Commits   ahead 1, behind 0                        │
│ Status    draft                                    │
├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here..                      │
├────────────────────────────────────────────────────┤
│ ● Revision 97e18f8 @ 2a46583 by alice (you) now    │
╰────────────────────────────────────────────────────╯