mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-09 13:20:43 +08:00
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`.
6.4 KiB
6.4 KiB
If you ever want to change the title and descriptions associated with
a patch and its revisions, we can always use the rad patch edit
command.
First off, we'll have to set up a patch and an updated revision:
$ git checkout -b changes
$ touch README.md
$ git add README.md
$ git commit --message "Add README, just for the fun"
[changes 03c02af] Add README, just for the fun
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
$ git push rad -o patch.message="Add README, just for the fun" HEAD:refs/patches
✓ Patch 89f7afb1511b976482b21f6b2f39aef7f4fb88a2 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
$ touch LICENSE
$ git add LICENSE
$ git commit -v -m "Define the LICENSE"
[changes 8945f61] Define the LICENSE
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 LICENSE
$ git push -f -o patch.message="Add License"
✓ Patch 89f7afb updated to revision 5d78dd5376453e25df5988ec86951c99cb73742c
To compare against your previous revision 89f7afb, run:
git range-diff f2de534[..] 03c02af[..] 8945f61[..]
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
03c02af..8945f61 changes -> patches/89f7afb1511b976482b21f6b2f39aef7f4fb88a2
Let's look at the patch, to see what it looks like before editing it:
$ rad patch show 89f7afb
╭────────────────────────────────────────────────────╮
│ Title Add README, just for the fun │
│ Patch 89f7afb1511b976482b21f6b2f39aef7f4fb88a2 │
│ Author alice (you) │
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
│ Base [.. ] │
│ Branches changes │
│ Commits ahead 2, behind 0 │
│ Status open │
├────────────────────────────────────────────────────┤
│ 8945f61 Define the LICENSE │
│ 03c02af Add README, just for the fun │
├────────────────────────────────────────────────────┤
│ ● Revision 89f7afb @ 03c02af by alice (you) now │
│ ↑ Revision 5d78dd5 @ 8945f61 by alice (you) now │
╰────────────────────────────────────────────────────╯
We can change the title and description of the patch itself by using a
multi-line message (using two --message options here):
$ rad patch edit 89f7afb --message "Add Metadata" --message "Add README & LICENSE" --no-announce
$ rad patch show 89f7afb
╭────────────────────────────────────────────────────╮
│ Title Add Metadata │
│ Patch 89f7afb1511b976482b21f6b2f39aef7f4fb88a2 │
│ Author alice (you) │
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
│ Base [.. ] │
│ Branches changes │
│ Commits ahead 2, behind 0 │
│ Status open │
│ │
│ Add README & LICENSE │
├────────────────────────────────────────────────────┤
│ 8945f61 Define the LICENSE │
│ 03c02af Add README, just for the fun │
├────────────────────────────────────────────────────┤
│ ● Revision 89f7afb @ 03c02af by alice (you) now │
│ ↑ Revision 5d78dd5 @ 8945f61 by alice (you) now │
╰────────────────────────────────────────────────────╯
Notice that the Title is now Add Metadata, and the patch now has a
description Add README & LICENSE.
If we want to change a specific revision's description, we can use the
--revision option:
$ rad patch edit 89f7afb --revision 5d78dd5 --message "Changes: Adds LICENSE file" --no-announce
$ rad patch show 89f7afb
╭────────────────────────────────────────────────────╮
│ Title Add Metadata │
│ Patch 89f7afb1511b976482b21f6b2f39aef7f4fb88a2 │
│ Author alice (you) │
│ Head 8945f6189adf027892c85ac57f7e9341049c2537 │
│ Base [.. ] │
│ Branches changes │
│ Commits ahead 2, behind 0 │
│ Status open │
│ │
│ Add README & LICENSE │
├────────────────────────────────────────────────────┤
│ 8945f61 Define the LICENSE │
│ 03c02af Add README, just for the fun │
├────────────────────────────────────────────────────┤
│ ● Revision 89f7afb @ 03c02af by alice (you) now │
│ ↑ Revision 5d78dd5 @ 8945f61 by alice (you) now │
╰────────────────────────────────────────────────────╯
We can see that this didn't affect the patch's description, but currently there's no way of seeing a revision's description in the CLI.