Files
heartwood/radicle-cli/examples/rad-patch-draft.md
T
Alexis Sellier 649d59f143 cob: Include head in initial patch entry in DAG
This change ensures that we include as a parent to the initial commit
of a patch COB, the head of the branch we are proposing as a patch.

This was already happening for patch updates, but we forgot to also
include it for the initial patch revision.

This ensures that the code is always fetched alongside the patch.
2023-05-02 09:18:17 +02:00

5.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:

$ rad patch open --draft -m "Nothing yet" --quiet
6d7793b859860db775fd8ff1d18ffb6de2b9ca0e

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

$ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
╭─────────────────────────────────────────────────────────────────────────────────────────╮
│ Title     Nothing yet                                                                   │
│ Patch     6d7793b859860db775fd8ff1d18ffb6de2b9ca0e                                      │
│ Author    did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi                      │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7                                      │
│ Branches  cloudhead/draft                                                               │
│ Commits   ahead 1, behind 0                                                             │
│ Status    draft                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [   ...    ] │
╰─────────────────────────────────────────────────────────────────────────────────────────╯

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

$ rad patch ready 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
$ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
╭─────────────────────────────────────────────────────────────────────────────────────────╮
│ Title     Nothing yet                                                                   │
│ Patch     6d7793b859860db775fd8ff1d18ffb6de2b9ca0e                                      │
│ Author    did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi                      │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7                                      │
│ Branches  cloudhead/draft                                                               │
│ Commits   ahead 1, behind 0                                                             │
│ Status    open                                                                          │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [   ...    ] │
╰─────────────────────────────────────────────────────────────────────────────────────────╯

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

$ rad patch ready --undo 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
$ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
╭─────────────────────────────────────────────────────────────────────────────────────────╮
│ Title     Nothing yet                                                                   │
│ Patch     6d7793b859860db775fd8ff1d18ffb6de2b9ca0e                                      │
│ Author    did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi                      │
│ Head      2a465832b5a76abe25be44a3a5d224bbd7741ba7                                      │
│ Branches  cloudhead/draft                                                               │
│ Commits   ahead 1, behind 0                                                             │
│ Status    draft                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) [   ...    ] │
╰─────────────────────────────────────────────────────────────────────────────────────────╯