Files
heartwood/radicle-cli/examples/rad-patch-update.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

3.9 KiB

Let's explore the rad patch update plumbing command. First we create a patch:

$ git checkout -q -b feature/1
$ git commit -q -m "Not a real change" --allow-empty
$ git push rad HEAD:refs/patches
✓ Patch 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
 * [new reference]   HEAD -> refs/patches
$ rad patch show 8f5dcedc07a89928fd450bce1479f2559bcfd1d4
╭────────────────────────────────────────────────────╮
│ Title     Not a real change                        │
│ Patch     8f5dcedc07a89928fd450bce1479f2559bcfd1d4 │
│ Author    z6MknSL…StBU8Vi (you)                    │
│ Head      51b2f0f77b9849bfaa3e9d3ff68ee2f57771d20c │
│ Branches  feature/1                                │
│ Commits   ahead 1, behind 0                        │
│ Status    open                                     │
├────────────────────────────────────────────────────┤
│ 51b2f0f Not a real change                          │
├────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) now              │
╰────────────────────────────────────────────────────╯

We can make some changes to the repository:

$ git mv README README.md
$ git commit -q -m "Rename readme file"

Let's push the changes, but not to the magic ref, that way the push doesn't update our patch:

$ git push rad HEAD:refs/heads/feature/1

Now, instead of using git push to update the patch, as we normally would, we run:

$ rad patch update 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 -m "Updated patch"
74d453f93d81bb535ffa4ef65c46e5bd0a76015d

The command outputs the new Revision ID, which we can now see here:

$ rad patch show 8f5dcedc07a89928fd450bce1479f2559bcfd1d4
╭─────────────────────────────────────────────────────────────────────╮
│ Title     Not a real change                                         │
│ Patch     8f5dcedc07a89928fd450bce1479f2559bcfd1d4                  │
│ Author    z6MknSL…StBU8Vi (you)                                     │
│ Head      4d272148458a17620541555b1f0905c01658aa9f                  │
│ Branches  feature/1                                                 │
│ Commits   ahead 2, behind 0                                         │
│ Status    open                                                      │
├─────────────────────────────────────────────────────────────────────┤
│ 4d27214 Rename readme file                                          │
│ 51b2f0f Not a real change                                           │
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) now                               │
│ ↑ updated to 74d453f93d81bb535ffa4ef65c46e5bd0a76015d (4d27214) now │
╰─────────────────────────────────────────────────────────────────────╯