Files
heartwood/radicle-cli/examples/rad-patch-draft.md
T
Alexis Sellier 3bd5589b1a cob: Stabilize formats
> I'm going to be making a set of breaking changes to COBs in order to
stabilize the data formats. This is hopefully a one-time change that
bundles various breaking changes.

All COBs have been reworked: issue, patch, id.

The changes included are:

* Revise the assign and tag actions to take a single list of
  assignees/tags to set, instead of an "add" and a "remove" list. This
  makes API usage simpler when editing issues, and simplifies the apply
  function
* Rename "tags" to "labels", and the tag action to label. This is
  because tag is confusing in the context of git, as it could mean a git
  tag. Using label removes that confusion.
* Use DIDs instead of PublicKeys for assignees -- this is more
  future-proof
* Modify the manifest file format in the COB tree. Mainly, remove the
  `history_type` key which is redundant, and use camelCase for keys
* Flatten the `Thread` actions into the parent action type
* Ensure that operations on redacted objects do not fail, since
  redactions could have happened concurrently
* Use a consistent naming scheme for actions, using `.` as separator
* Consolidate comment types and remove `CodeComment`, by adding an
  optional `location` field to `Comment`
* Add many placeholder actions that are not yet implemented

To preserve backwards compatibility, a `legacy` module is created with
the old `apply` function. When loading the manifest, we check whether it
is a legacy COB or a "stable" COB, and in the legacy case, use the
legacy code to materialize the state and then convert the object into
the stable type. Eventually, we'll delete the legacy code.
2023-08-07 11:05:14 +02:00

5.9 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 79a1a5138b7f91c6dead5544ecde285dc3d0cb45 drafted
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
 * [new reference]   HEAD -> refs/patches

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

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

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

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

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

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