Files
heartwood/radicle-cli/examples/rad-patch-draft.md
T
Fintan Halpenny 82a53e3a53 radicle: UserInfo for Repository::create
The fetch V2 improvements introduced a `UserInfo` type that is used to
set the Git config's name and email when cloning a repository. This
`UserInfo` can also be used when creating a new `Repository`.

The `Storage` type now takes a `UserInfo` so that it can be passed to
`Repository::create`, for creating a new repository.

For testing, this requires adding a new `fixtures::user` so that
testing `Storage` instances can be easily constructed.

It also means that the `radicle-cli` tests all changed with new SHAs
since the name and email are used as part of the hashing input.

N.b. the order of the timelines while testing the identity cob
changed. It's not clear why that is.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-09 16:43:34 +01:00

4.5 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 193a2540ded82245b49971de8afc89a129502c6d drafted
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
 * [new reference]   HEAD -> refs/patches

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

$ rad patch show 193a2540ded82245b49971de8afc89a129502c6d
╭────────────────────────────────────────────────────╮
│ Title     Nothing yet                              │
│ Patch     193a2540ded82245b49971de8afc89a129502c6d │
│ Author    z6MknSL…StBU8Vi (you)                    │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches  cloudhead/draft                          │
│ Commits   ahead 1, behind 0                        │
│ Status    draft                                    │
├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here..                      │
├────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) [   ...    ]     │
╰────────────────────────────────────────────────────╯

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

$ rad patch ready 193a2540ded82245b49971de8afc89a129502c6d
$ rad patch show 193a2540ded82245b49971de8afc89a129502c6d
╭────────────────────────────────────────────────────╮
│ Title     Nothing yet                              │
│ Patch     193a2540ded82245b49971de8afc89a129502c6d │
│ Author    z6MknSL…StBU8Vi (you)                    │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches  cloudhead/draft                          │
│ Commits   ahead 1, behind 0                        │
│ Status    open                                     │
├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here..                      │
├────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) [   ...    ]     │
╰────────────────────────────────────────────────────╯

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

$ rad patch ready --undo 193a2540ded82245b49971de8afc89a129502c6d
$ rad patch show 193a2540ded82245b49971de8afc89a129502c6d
╭────────────────────────────────────────────────────╮
│ Title     Nothing yet                              │
│ Patch     193a2540ded82245b49971de8afc89a129502c6d │
│ Author    z6MknSL…StBU8Vi (you)                    │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches  cloudhead/draft                          │
│ Commits   ahead 1, behind 0                        │
│ Status    draft                                    │
├────────────────────────────────────────────────────┤
│ 2a46583 Nothing to see here..                      │
├────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) [   ...    ]     │
╰────────────────────────────────────────────────────╯