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
This commit is contained in:
Fintan Halpenny 2023-10-25 16:58:25 +01:00 committed by cloudhead
parent 9f81de7ef3
commit 82a53e3a53
No known key found for this signature in database
36 changed files with 422 additions and 327 deletions

View File

@ -6,7 +6,7 @@ First we add a second delegate, Bob, to our repo:
``` ~alice
$ rad id update --title "Add Bob" --description "" --delegate did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -q
60cbee1bbc49fcbb8063249bc4112c8886a756ba
c036c0d89ce26aef3ad7da402157dba16b5163b4
$ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
✓ Remote bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk added
✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67…v4N1tRk

View File

@ -6,7 +6,7 @@ First create an issue.
$ rad issue open --title "flux capacitor underpowered" --description "Flux capacitor power requirements exceed current supply" --no-announce
╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │
│ Issue 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
│ Issue d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
│ Author z6MknSL…StBU8Vi (you) │
│ Status open │
│ │
@ -21,7 +21,7 @@ $ rad issue list
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Labels Assignees Opened │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ● 9bf82c1 flux capacitor underpowered z6MknSL…StBU8Vi (you) now │
│ ● d185ee1 flux capacitor underpowered z6MknSL…StBU8Vi (you) now │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
```
@ -45,7 +45,7 @@ $ rad patch
╭─────────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Head + - Updated │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ ● a892664 Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │
│ ● 6ff4f09 Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │
╰─────────────────────────────────────────────────────────────────────────────────────────╯
```
@ -53,17 +53,17 @@ Both issue and patch COBs can be listed.
```
$ rad cob list --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.issue
9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
$ rad cob list --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.patch
a8926643a8f6a65bc386b0131621994000485d4d
6ff4f09c1b5a81347981f59b02ef43a31a07cdae
```
We can look at the issue COB.
```
$ rad cob show --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.issue --object 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
commit 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
parent 2317f74de0494c489a233ca6f29f2b8bff6d4f15
$ rad cob show --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.issue --object d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
commit d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
parent 0656c217f917c3e06234771e9ecae53aba5e173e
author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
date Thu, 15 Dec 2022 17:28:04 +0000
@ -92,9 +92,9 @@ date Thu, 15 Dec 2022 17:28:04 +0000
We can look at the patch COB too.
```
$ rad cob show --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.patch --object a8926643a8f6a65bc386b0131621994000485d4d
commit a8926643a8f6a65bc386b0131621994000485d4d
parent 2317f74de0494c489a233ca6f29f2b8bff6d4f15
$ rad cob show --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.patch --object 6ff4f09c1b5a81347981f59b02ef43a31a07cdae
commit 6ff4f09c1b5a81347981f59b02ef43a31a07cdae
parent 0656c217f917c3e06234771e9ecae53aba5e173e
parent 3e674d1a1df90807e934f9ae5da2591dd6848a33
parent f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi

View File

@ -2,7 +2,7 @@ First let's add Bob as a delegate, and sync the changes to Bob:
``` ~alice
$ rad id update --title "Add Bob" --description "Add Bob as a delegate" --delegate did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --threshold 2 -q
bd41a1cc152a7cb8b9fb84261e4214ffa4cdb7a4
0ca42d376bd566631083c8913cf86bec722da392
```
``` ~bob
$ cd heartwood
@ -16,11 +16,11 @@ time:
``` ~alice
$ rad id update --title "Edit project name" --description "" --payload "xyz.radicle.project" "name" '"heart"' -q
6c07e4e604d855f6730f884dc56216c5698ef7f8
12d7300d1bbba84e4e5760c8c61999bf5fefb81a
```
``` ~bob
$ rad id update --title "Edit project name" --description "" --payload "xyz.radicle.project" "name" '"wood"' -q
2e7f195fde751b73aabe4730bd1047c87893a787
89b2623e7f2ddf5748661b15b9975ab0b4ee17ab
```
When Alice syncs with Bob, she notices the problem: there are two active
@ -34,10 +34,10 @@ $ rad id list
╭─────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Status Created │
├─────────────────────────────────────────────────────────────────────────────────┤
│ ● 6c07e4e Edit project name alice (you) active now │
│ ● 2e7f195 Edit project name bob z6Mkt67…v4N1tRk active now │
│ ● bd41a1c Add Bob alice (you) accepted now │
│ ● 2317f74 Initial revision alice (you) accepted now │
│ ● 89b2623 Edit project name bob z6Mkt67…v4N1tRk active now │
│ ● 12d7300 Edit project name alice (you) active now │
│ ● 0ca42d3 Add Bob alice (you) accepted now │
│ ● 0656c21 Initial revision alice (you) accepted now │
╰─────────────────────────────────────────────────────────────────────────────────╯
```
@ -45,15 +45,15 @@ This isn't a problem as long as we don't try to accept both. So let's accept
Bob's:
``` ~alice
$ rad id accept 2e7f195 -q
$ rad id accept 89b2623 -q
$ rad id list
╭─────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Status Created │
├─────────────────────────────────────────────────────────────────────────────────┤
│ ● 6c07e4e Edit project name alice (you) stale now │
│ ● 2e7f195 Edit project name bob z6Mkt67…v4N1tRk accepted now │
│ ● bd41a1c Add Bob alice (you) accepted now │
│ ● 2317f74 Initial revision alice (you) accepted now │
│ ● 89b2623 Edit project name bob z6Mkt67…v4N1tRk accepted now │
│ ● 12d7300 Edit project name alice (you) stale now │
│ ● 0ca42d3 Add Bob alice (you) accepted now │
│ ● 0656c21 Initial revision alice (you) accepted now │
╰─────────────────────────────────────────────────────────────────────────────────╯
```
@ -66,16 +66,16 @@ $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
✓ Fetched repository from 1 seed(s)
```
``` ~bob (fail)
$ rad id accept 6c07e4e -q
$ rad id accept 12d7300 -q
✗ Error: cannot vote on revision that is stale
$ rad id reject 6c07e4e -q
$ rad id reject 12d7300 -q
✗ Error: cannot vote on revision that is stale
```
``` ~bob
$ rad id show 6c07e4e
$ rad id show 12d7300
╭────────────────────────────────────────────────────────────────────────╮
│ Title Edit project name │
│ Revision 6c07e4e604d855f6730f884dc56216c5698ef7f8
│ Revision 12d7300d1bbba84e4e5760c8c61999bf5fefb81a
│ Blob e93aa3e3c5c448bacd3537a81daf1437eccd046a │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
│ State stale │

View File

@ -1,6 +1,6 @@
``` ~alice
$ rad id update --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --title "Add Bob" --description "" --threshold 2 --delegate did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --no-confirm -q
5666f744e2bc2333cab30ea0256bc4b61c3205bf
069e7d58faa9a7473d27f5510d676af33282796f
```
``` ~bob
@ -8,10 +8,10 @@ $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
✓ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from z6MknSL…StBU8Vi..
✓ Fetched repository from 1 seed(s)
$ rad id update --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --title "Add Eve" --description "" --delegate did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn --no-confirm
✓ Identity revision e4b005ae70116fbe91340fef43127e86ab17e476 created
✓ Identity revision 9e5aceb50f9307ddcb29923dbaeb5ccbfd07766c created
╭────────────────────────────────────────────────────────────────────────╮
│ Title Add Eve │
│ Revision e4b005ae70116fbe91340fef43127e86ab17e476
│ Revision 9e5aceb50f9307ddcb29923dbaeb5ccbfd07766c
│ Blob 4c7fd4c7b7d7fd5d7088a7c952556fab99a034e9 │
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │
│ State active │
@ -47,11 +47,11 @@ $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --delegates
did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (alice)
did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob)
$ rad id accept e4b005ae70116fbe91340fef43127e86ab17e476 --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --no-confirm
✓ Revision e4b005ae70116fbe91340fef43127e86ab17e476 accepted
$ rad id accept 9e5aceb50f9307ddcb29923dbaeb5ccbfd07766c --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --no-confirm
✓ Revision 9e5aceb50f9307ddcb29923dbaeb5ccbfd07766c accepted
╭────────────────────────────────────────────────────────────────────────╮
│ Title Add Eve │
│ Revision e4b005ae70116fbe91340fef43127e86ab17e476
│ Revision 9e5aceb50f9307ddcb29923dbaeb5ccbfd07766c
│ Blob 4c7fd4c7b7d7fd5d7088a7c952556fab99a034e9 │
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │
│ State accepted │
@ -68,7 +68,7 @@ did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn
``` ~alice
$ rad id update --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --title "Make private" --description "" --visibility private --no-confirm -q
3fba3b17851cde9814f35acce4f740f53fb63dd7
efb8cdd368b9745396f832386f9c7d46988f6bd5
```
We can list all revisions:
@ -78,33 +78,33 @@ $ rad id list
╭────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Status Created │
├────────────────────────────────────────────────────────────────────────────────┤
│ ● 3fba3b1 Make private alice (you) active now │
│ ● e4b005a Add Eve bob z6Mkt67…v4N1tRk accepted now │
│ ● 5666f74 Add Bob alice (you) accepted now │
│ ● 2317f74 Initial revision alice (you) accepted now │
│ ● efb8cdd Make private alice (you) active now │
│ ● 9e5aceb Add Eve bob z6Mkt67…v4N1tRk accepted now │
│ ● 069e7d5 Add Bob alice (you) accepted now │
│ ● 0656c21 Initial revision alice (you) accepted now │
╰────────────────────────────────────────────────────────────────────────────────╯
```
Despite being a delegate, Bob can't edit or redact Alice's revision:
``` ~bob (fail)
$ rad id redact 3fba3b17851cde9814f35acce4f740f53fb63dd7
$ rad id redact efb8cdd368b9745396f832386f9c7d46988f6bd5
[..]
```
``` ~bob (fail)
$ rad id edit --title "Boo!" --description "Boo!" 3fba3b17851cde9814f35acce4f740f53fb63dd7
$ rad id edit --title "Boo!" --description "Boo!" efb8cdd368b9745396f832386f9c7d46988f6bd5
[..]
```
Alice can edit:
``` ~alice
$ rad id edit --title "Make private" --description "Privacy is cool." 3fba3b17851cde9814f35acce4f740f53fb63dd7
✓ Revision 3fba3b17851cde9814f35acce4f740f53fb63dd7 edited
$ rad id show 3fba3b17851cde9814f35acce4f740f53fb63dd7
$ rad id edit --title "Make private" --description "Privacy is cool." efb8cdd368b9745396f832386f9c7d46988f6bd5
✓ Revision efb8cdd368b9745396f832386f9c7d46988f6bd5 edited
$ rad id show efb8cdd368b9745396f832386f9c7d46988f6bd5
╭────────────────────────────────────────────────────────────────────────╮
│ Title Make private │
│ Revision 3fba3b17851cde9814f35acce4f740f53fb63dd7
│ Revision efb8cdd368b9745396f832386f9c7d46988f6bd5
│ Blob 79bc5c39103e811a3c9f11744f9a4029f063a5de │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
│ State active │
@ -142,21 +142,21 @@ $ rad id show 3fba3b17851cde9814f35acce4f740f53fb63dd7
And she can redact her revision:
``` ~alice
$ rad id redact 3fba3b17851cde9814f35acce4f740f53fb63dd7
✓ Revision 3fba3b17851cde9814f35acce4f740f53fb63dd7 redacted
$ rad id redact efb8cdd368b9745396f832386f9c7d46988f6bd5
✓ Revision efb8cdd368b9745396f832386f9c7d46988f6bd5 redacted
```
``` ~alice (fail)
$ rad id show 3fba3b17851cde9814f35acce4f740f53fb63dd7
✗ Error: revision `3fba3b17851cde9814f35acce4f740f53fb63dd7` not found
$ rad id show efb8cdd368b9745396f832386f9c7d46988f6bd5
✗ Error: revision `efb8cdd368b9745396f832386f9c7d46988f6bd5` not found
```
Finally, Alice can also propose to remove Bob:
``` ~alice
$ rad id update --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --title "Remove Bob" --description "" --rescind did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --no-confirm
✓ Identity revision 572b3189cf5a9cdba5f77db183a29a50562ba318 created
✓ Identity revision faf5fb018803d2883e9906bb9c08b6ec83aa55dd created
╭────────────────────────────────────────────────────────────────────────╮
│ Title Remove Bob │
│ Revision 572b3189cf5a9cdba5f77db183a29a50562ba318
│ Revision faf5fb018803d2883e9906bb9c08b6ec83aa55dd
│ Blob 7109c1c201c223dd4e9fdb10f7330dc6f0310258 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
│ State active │

View File

@ -15,10 +15,10 @@ threshold to `2`.
```
$ rad id update --title "Add Bob" --description "Add Bob as a delegate" --delegate did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn --threshold 2
✓ Identity revision d067ffc7bf65d318dd68ca4b8c7adf61a369ea2f created
✓ Identity revision 07829cdd1993295cd6be18de6219fead428b4a5e created
╭───────────────────────────────────────────────────────────────────╮
│ Title Add Bob │
│ Revision d067ffc7bf65d318dd68ca4b8c7adf61a369ea2f
│ Revision 07829cdd1993295cd6be18de6219fead428b4a5e
│ Blob 7109c1c201c223dd4e9fdb10f7330dc6f0310258 │
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
│ State accepted │
@ -93,22 +93,22 @@ $ rad inspect --identity
We can also look at the document's COB directly:
```
$ rad cob show --object 2317f74de0494c489a233ca6f29f2b8bff6d4f15 --type xyz.radicle.id --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
commit d067ffc7bf65d318dd68ca4b8c7adf61a369ea2f
parent 2317f74de0494c489a233ca6f29f2b8bff6d4f15
$ rad cob show --object 0656c217f917c3e06234771e9ecae53aba5e173e --type xyz.radicle.id --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
commit 07829cdd1993295cd6be18de6219fead428b4a5e
parent 0656c217f917c3e06234771e9ecae53aba5e173e
author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
date Thu, 15 Dec 2022 17:28:04 +0000
{
"blob": "7109c1c201c223dd4e9fdb10f7330dc6f0310258",
"description": "Add Bob as a delegate",
"parent": "2317f74de0494c489a233ca6f29f2b8bff6d4f15",
"parent": "0656c217f917c3e06234771e9ecae53aba5e173e",
"signature": "z3sne3sdReZ4AtgxQmn7R1pQnz7E9ZEUoRfCJDJ8ytgnBMFW4DJqRHuBz2h1NK4QdGEy3QCpyVoJKfE95tNoivXwz",
"title": "Add Bob",
"type": "revision"
}
commit 2317f74de0494c489a233ca6f29f2b8bff6d4f15
commit 0656c217f917c3e06234771e9ecae53aba5e173e
author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
date Thu, 15 Dec 2022 17:28:04 +0000
@ -126,14 +126,14 @@ Note that once a revision is accepted, it can't be edited, redacted or otherwise
acted upon:
``` (fail)
$ rad id redact d067ffc7bf65d318dd68ca4b8c7adf61a369ea2f
$ rad id redact 07829cdd1993295cd6be18de6219fead428b4a5e
✗ Error: [..]
```
``` (fail)
$ rad id reject d067ffc7bf65d318dd68ca4b8c7adf61a369ea2f
$ rad id reject 07829cdd1993295cd6be18de6219fead428b4a5e
✗ Error: [..]
```
``` (fail)
$ rad id accept d067ffc7bf65d318dd68ca4b8c7adf61a369ea2f
$ rad id accept 07829cdd1993295cd6be18de6219fead428b4a5e
✗ Error: [..]
```

View File

@ -21,7 +21,7 @@ z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
└── refs
   ├── cobs
   │   └── xyz.radicle.id
   │      └── 2317f74de0494c489a233ca6f29f2b8bff6d4f15
   │      └── 0656c217f917c3e06234771e9ecae53aba5e173e
   ├── heads
   │   └── master
   └── rad
@ -49,7 +49,7 @@ history:
```
$ rad inspect --history
commit 2317f74de0494c489a233ca6f29f2b8bff6d4f15
commit 0656c217f917c3e06234771e9ecae53aba5e173e
blob d96f425412c9f8ad5d9a9a05c9831d0728e2338d
date Thu, 15 Dec 2022 17:28:04 +0000

View File

@ -7,7 +7,7 @@ Let's say the new car you are designing with your peers has a problem with its f
$ rad issue open --title "flux capacitor underpowered" --description "Flux capacitor power requirements exceed current supply" --no-announce
╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │
│ Issue 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
│ Issue d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
│ Author z6MknSL…StBU8Vi (you) │
│ Status open │
│ │
@ -22,17 +22,17 @@ $ rad issue list
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Labels Assignees Opened │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ● 9bf82c1 flux capacitor underpowered z6MknSL…StBU8Vi (you) now │
│ ● d185ee1 flux capacitor underpowered z6MknSL…StBU8Vi (you) now │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
```
Show the issue information issue.
```
$ rad issue show 9bf82c1
$ rad issue show d185ee1
╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │
│ Issue 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
│ Issue d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
│ Author z6MknSL…StBU8Vi (you) │
│ Status open │
│ │
@ -49,7 +49,7 @@ others to work on. This is to ensure work is not duplicated.
Let's assign ourselves to this one.
```
$ rad assign 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d --to did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ rad assign d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 --to did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
It will now show in the list of issues assigned to us.
@ -59,14 +59,14 @@ $ rad issue list --assigned
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Labels Assignees Opened │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ● 9bf82c1 flux capacitor underpowered z6MknSL…StBU8Vi (you) z6MknSL…StBU8Vi now │
│ ● d185ee1 flux capacitor underpowered z6MknSL…StBU8Vi (you) z6MknSL…StBU8Vi now │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```
Note: this can always be undone with the `unassign` subcommand.
```
$ rad unassign 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d --from did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
$ rad unassign d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 --from did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```
Great, now we have communicated to the world about our car's defect.
@ -75,28 +75,28 @@ But wait! We've found an important detail about the car's power requirements.
It will help whoever works on a fix.
```
$ rad issue comment 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d --message 'The flux capacitor needs 1.21 Gigawatts' -q
1a8e9d3d62d22b247064b12d1d89ad8598504129
$ rad issue comment 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d --reply-to 1a8e9d3d62d22b247064b12d1d89ad8598504129 --message 'More power!' -q
fb6ab7e0ca5be3c34688bcae37d7302bb824decf
$ rad issue comment d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 --message 'The flux capacitor needs 1.21 Gigawatts' -q
14019611935fd1c66458111a5b49f0a7350c226f
$ rad issue comment d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 --reply-to 14019611935fd1c66458111a5b49f0a7350c226f --message 'More power!' -q
e342e47b7dd93451d47c806a0faeb0b5e957da2c
```
We can see our comments by showing the issue:
```
$ rad issue show 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
$ rad issue show d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │
│ Issue 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
│ Issue d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
│ Author z6MknSL…StBU8Vi (you) │
│ Status open │
│ │
│ Flux capacitor power requirements exceed current supply │
├─────────────────────────────────────────────────────────┤
│ z6MknSL…StBU8Vi (you) now 1a8e9d3
│ z6MknSL…StBU8Vi (you) now 1401961
│ The flux capacitor needs 1.21 Gigawatts │
├─────────────────────────────────────────────────────────┤
│ z6MknSL…StBU8Vi (you) now fb6ab7e │
│ z6MknSL…StBU8Vi (you) now e342e47
│ More power! │
╰─────────────────────────────────────────────────────────╯
```

View File

@ -2,16 +2,16 @@ Labeling an issue is easy, let's add the `bug` and `good-first-issue` labels to
some issue:
```
$ rad label 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d bug good-first-issue
$ rad label d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 bug good-first-issue
```
We can now show the issue to check whether those labels were added:
```
$ rad issue show 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d --format header
$ rad issue show d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 --format header
╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │
│ Issue 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
│ Issue d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
│ Author z6MknSL…StBU8Vi (you) │
│ Labels bug, good-first-issue │
│ Status open │
@ -23,16 +23,16 @@ $ rad issue show 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d --format header
Untagging an issue is very similar:
```
$ rad unlabel 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d good-first-issue
$ rad unlabel d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 good-first-issue
```
Notice that the `good-first-issue` label has disappeared:
```
$ rad issue show 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d --format header
$ rad issue show d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 --format header
╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │
│ Issue 9bf82c141d5a9c54bb1d6b4517eb3bb7da8fb30d
│ Issue d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61
│ Author z6MknSL…StBU8Vi (you) │
│ Labels bug │
│ Status open │

View File

@ -4,7 +4,7 @@ Let's start by creating a patch.
$ git checkout -b feature/1 -q
$ git commit --allow-empty -q -m "First change"
$ git push rad HEAD:refs/patches
✓ Patch f6c96cca58521d6dbb6cd4e6b7124342b9a86945 opened
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -26,8 +26,8 @@ update it, we expect it to be updated and merged:
``` (stderr) RAD_SOCKET=/dev/null
$ git checkout feature/1 -q
$ git push -f
✓ Patch f6c96cc updated to [...]
✓ Patch f6c96cca58521d6dbb6cd4e6b7124342b9a86945 merged
✓ Patch a1207f6 updated to [...]
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 merged
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ 20aa5dd...954bcdb feature/1 -> patches/f6c96cca58521d6dbb6cd4e6b7124342b9a86945 (forced update)
+ 20aa5dd...954bcdb feature/1 -> patches/a1207f6e82700e42cc46c9c38c7786b18cbd2040 (forced update)
```

View File

@ -4,7 +4,7 @@ First, let's create a patch.
$ git checkout -b feature/1 -q
$ git commit --allow-empty -q -m "First change"
$ git push rad HEAD:refs/patches
✓ Patch f6c96cca58521d6dbb6cd4e6b7124342b9a86945 opened
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -36,7 +36,7 @@ committer radicle <radicle@localhost> 1671125284 +0000
Finally, we push master and expect the patch to be merged.
``` (stderr) RAD_SOCKET=/dev/null
$ git push rad master
✓ Patch f6c96cca58521d6dbb6cd4e6b7124342b9a86945 merged
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 merged
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..737a10c master -> master
```

View File

@ -4,7 +4,7 @@ Let's start by creating two patches.
$ git checkout -b feature/1 -q
$ git commit --allow-empty -q -m "First change"
$ git push rad HEAD:refs/patches
✓ Patch f6c96cca58521d6dbb6cd4e6b7124342b9a86945 opened
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -12,7 +12,7 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
$ git checkout -b feature/2 -q master
$ git commit --allow-empty -q -m "Second change"
$ git push rad HEAD:refs/patches
✓ Patch 3b8203713e2945a6c46b238e6a432bd2711d3ccf opened
✓ Patch 8357a9f1d61e80309d314491aa754969d9f47d77 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -22,8 +22,8 @@ This creates some remote tracking branches for us:
```
$ git branch -r
rad/master
rad/patches/3b8203713e2945a6c46b238e6a432bd2711d3ccf
rad/patches/f6c96cca58521d6dbb6cd4e6b7124342b9a86945
rad/patches/8357a9f1d61e80309d314491aa754969d9f47d77
rad/patches/a1207f6e82700e42cc46c9c38c7786b18cbd2040
```
And some remote refs:
@ -34,15 +34,15 @@ z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
└── refs
   ├── cobs
   │   ├── xyz.radicle.id
   │   │   └── 2317f74de0494c489a233ca6f29f2b8bff6d4f15
   │   │   └── 0656c217f917c3e06234771e9ecae53aba5e173e
   │   └── xyz.radicle.patch
   │      ├── 3b8203713e2945a6c46b238e6a432bd2711d3ccf
   │      └── f6c96cca58521d6dbb6cd4e6b7124342b9a86945
   │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77
   │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040
   ├── heads
   │   ├── master
   │   └── patches
   │      ├── 3b8203713e2945a6c46b238e6a432bd2711d3ccf
   │      └── f6c96cca58521d6dbb6cd4e6b7124342b9a86945
   │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77
   │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040
   └── rad
      ├── id
      └── sigrefs
@ -61,8 +61,8 @@ When we push to `rad/master`, we automatically merge the patches:
``` (stderr) RAD_SOCKET=/dev/null
$ git push rad master
✓ Patch 3b8203713e2945a6c46b238e6a432bd2711d3ccf merged
✓ Patch f6c96cca58521d6dbb6cd4e6b7124342b9a86945 merged
✓ Patch 8357a9f1d61e80309d314491aa754969d9f47d77 merged
✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 merged
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..d6399c7 master -> master
```
@ -91,10 +91,10 @@ z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
└── refs
   ├── cobs
   │   ├── xyz.radicle.id
   │   │   └── 2317f74de0494c489a233ca6f29f2b8bff6d4f15
   │   │   └── 0656c217f917c3e06234771e9ecae53aba5e173e
   │   └── xyz.radicle.patch
   │      ├── 3b8203713e2945a6c46b238e6a432bd2711d3ccf
   │      └── f6c96cca58521d6dbb6cd4e6b7124342b9a86945
   │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77
   │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040
   ├── heads
   │   └── master
   └── rad

View File

@ -37,7 +37,7 @@ $ git log --graph --decorate --abbrev-commit --pretty=oneline --all
Then we create a patch from `feature/1`:
``` (stderr)
$ git push rad feature/1:refs/patches
✓ Patch 71e51dfcf7ca124a75ec6e0cb21b13bf86b8bb2e opened
✓ Patch f03f6ea57890ba8937269190d559d32105b36e03 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] feature/1 -> refs/patches
```
@ -48,17 +48,17 @@ $ rad patch list
╭────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Head + - Updated │
├────────────────────────────────────────────────────────────────────────┤
│ ● 71e51df Add Alan z6MknSL…StBU8Vi (you) 5c88a79 +1 -0 now │
│ ● f03f6ea Add Alan z6MknSL…StBU8Vi (you) 5c88a79 +1 -0 now │
╰────────────────────────────────────────────────────────────────────────╯
```
When showing the patch, we see that it is `ahead 1, behind 1`, since master has
diverged by one commit:
```
$ rad patch show -v -p 71e51df
$ rad patch show -v -p f03f6ea
╭────────────────────────────────────────────────────╮
│ Title Add Alan │
│ Patch 71e51dfcf7ca124a75ec6e0cb21b13bf86b8bb2e
│ Patch f03f6ea57890ba8937269190d559d32105b36e03
│ Author z6MknSL…StBU8Vi (you) │
│ Head 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │
│ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │
@ -93,7 +93,7 @@ $ git checkout -q -b feature/2 feature/1
$ sed -i '$a Mel Farna' CONTRIBUTORS
$ git commit -a -q -m "Add Mel"
$ git push -o patch.message="Add Mel" rad HEAD:refs/patches
✓ Patch 364cc2809f14c1bc74a8868159e87eb3844eb7e2 opened
✓ Patch 13a3d64f00e1c3f01c4d65fe115d2a2ed57d6cb7 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -101,10 +101,10 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
When we look at the patch, we see that it has both commits, because this new
patch uses the same base as the previous patch:
```
$ rad patch show -v 364cc2809f14c1bc74a8868159e87eb3844eb7e2
$ rad patch show -v 13a3d64f00e1c3f01c4d65fe115d2a2ed57d6cb7
╭────────────────────────────────────────────────────╮
│ Title Add Mel │
│ Patch 364cc2809f14c1bc74a8868159e87eb3844eb7e2
│ Patch 13a3d64f00e1c3f01c4d65fe115d2a2ed57d6cb7
│ Author z6MknSL…StBU8Vi (you) │
│ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │
│ Base f64fb2c8fe28f7c458c72ec8d700373924794943 │
@ -124,7 +124,7 @@ If we want to instead create a "stacked" patch, we can do so with the
``` (stderr)
$ git push -o patch.message="Add Mel #2" -o patch.base=HEAD^ rad HEAD:refs/patches
✓ Patch 11ab7fbec82c3aed393d7a696d6b3c7714735056 opened
✓ Patch c0083bdc7f7acda2e7a9db3134566dd385c7e88e opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -136,10 +136,10 @@ However, since the patch is still intended to be merged into `master`, we see
that it is still two commits ahead and one behind from `master`.
```
$ rad patch show -v 11ab7fbec82c3aed393d7a696d6b3c7714735056
$ rad patch show -v c0083bdc7f7acda2e7a9db3134566dd385c7e88e
╭────────────────────────────────────────────────────╮
│ Title Add Mel #2
│ Patch 11ab7fbec82c3aed393d7a696d6b3c7714735056
│ Patch c0083bdc7f7acda2e7a9db3134566dd385c7e88e
│ Author z6MknSL…StBU8Vi (you) │
│ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │
│ Base 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │

View File

@ -22,7 +22,7 @@ Once the code is ready, we open (or create) a patch with our changes for the pro
``` (stderr)
$ git push rad -o patch.message="Define power requirements" -o patch.message="See details." HEAD:refs/patches
✓ Patch a8926643a8f6a65bc386b0131621994000485d4d opened
✓ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -30,9 +30,9 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
Now, let's checkout the patch that we just created:
```
$ rad patch checkout a892664
✓ Switched to branch patch/a892664
✓ Branch patch/a892664 setup to track rad/patches/a8926643a8f6a65bc386b0131621994000485d4d
$ rad patch checkout 6ff4f09
✓ Switched to branch patch/6ff4f09
✓ Branch patch/6ff4f09 setup to track rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae
```
Now, let's add a README too!
@ -41,7 +41,7 @@ Now, let's add a README too!
$ touch README.md
$ git add README.md
$ git commit --message "Add README, just for the fun"
[patch/a892664 27857ec] Add README, just for the fun
[patch/6ff4f09 27857ec] Add README, just for the fun
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
```
@ -55,18 +55,18 @@ Switched to branch 'master'
```
We can be safe in the knowledge that our changes on the
`patch/a892664` branch are still safe:
`patch/6ff4f09` branch are still safe:
```
$ rad patch checkout a892664
✓ Switched to branch patch/a892664
$ rad patch checkout 6ff4f09
✓ Switched to branch patch/6ff4f09
```
We can now finish off the update:
``` (stderr)
$ git push rad -o patch.message="Add README, just for the fun"
✓ Patch a892664 updated to 8d8aa0887a11f2a37fa8ed0d5723efa96fd727ed
✓ Patch 6ff4f09 updated to 0c0942e2ff2488617d950ede15567ca39a29972e
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
3e674d1..27857ec patch/a892664 -> patches/a8926643a8f6a65bc386b0131621994000485d4d
3e674d1..27857ec patch/6ff4f09 -> patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae
```

View File

@ -9,7 +9,7 @@ To open a patch in draft mode, we use the `--draft` option:
``` (stderr)
$ git push -o patch.draft -o patch.message="Nothing yet" rad HEAD:refs/patches
✓ Patch 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc drafted
✓ Patch 193a2540ded82245b49971de8afc89a129502c6d drafted
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -17,10 +17,10 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
We can confirm it's a draft by running `show`:
```
$ rad patch show 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
$ rad patch show 193a2540ded82245b49971de8afc89a129502c6d
╭────────────────────────────────────────────────────╮
│ Title Nothing yet │
│ Patch 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
│ Patch 193a2540ded82245b49971de8afc89a129502c6d
│ Author z6MknSL…StBU8Vi (you) │
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches cloudhead/draft │
@ -36,14 +36,14 @@ $ rad patch show 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
Once the patch is ready for review, we can use the `ready` command:
```
$ rad patch ready 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
$ rad patch ready 193a2540ded82245b49971de8afc89a129502c6d
```
```
$ rad patch show 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
$ rad patch show 193a2540ded82245b49971de8afc89a129502c6d
╭────────────────────────────────────────────────────╮
│ Title Nothing yet │
│ Patch 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
│ Patch 193a2540ded82245b49971de8afc89a129502c6d
│ Author z6MknSL…StBU8Vi (you) │
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches cloudhead/draft │
@ -60,11 +60,11 @@ If for whatever reason, it needed to go back into draft mode, we could use
the `--undo` flag:
```
$ rad patch ready --undo 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
$ rad patch show 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
$ rad patch ready --undo 193a2540ded82245b49971de8afc89a129502c6d
$ rad patch show 193a2540ded82245b49971de8afc89a129502c6d
╭────────────────────────────────────────────────────╮
│ Title Nothing yet │
│ Patch 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
│ Patch 193a2540ded82245b49971de8afc89a129502c6d
│ Author z6MknSL…StBU8Vi (you) │
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
│ Branches cloudhead/draft │
@ -75,3 +75,4 @@ $ rad patch show 78fcb007b4a3a898379f1e220d4b9fb54ad04cfc
├────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) [ ... ] │
╰────────────────────────────────────────────────────╯
```

View File

@ -49,22 +49,22 @@ $ cd heartwood
$ git checkout -b bob/feature -q
$ git commit --allow-empty -m "Bob's commit #1" -q
$ git push rad -o sync -o patch.message="Bob's patch" HEAD:refs/patches
✓ Patch a84ea2e8626a86442910a2e70837561538c20efb opened
✓ Patch 48c30356be83049458c0608d5a6f84789e9dc1d0 opened
✓ Synced with 1 node(s)
To rad://zhbMU4DUXrzB8xT6qAJh6yZ7bFMK/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
* [new reference] HEAD -> refs/patches
```
``` ~bob
$ git status --short --branch
## bob/feature...rad/patches/a84ea2e8626a86442910a2e70837561538c20efb
## bob/feature...rad/patches/48c30356be83049458c0608d5a6f84789e9dc1d0
```
Alice checks it out.
``` ~alice
$ rad patch checkout a84ea2e
✓ Switched to branch patch/a84ea2e
✓ Branch patch/a84ea2e setup to track rad/patches/a84ea2e8626a86442910a2e70837561538c20efb
$ rad patch checkout 48c3035
✓ Switched to branch patch/48c3035
✓ Branch patch/48c3035 setup to track rad/patches/48c30356be83049458c0608d5a6f84789e9dc1d0
$ git show
commit bdcdb30b3c0f513620dd0f1c24ff8f4f71de956b
Author: radicle <radicle@localhost>
@ -78,19 +78,19 @@ Bob then updates the patch.
``` ~bob (stderr)
$ git commit --allow-empty -m "Bob's commit #2" -q
$ git push rad -o sync -o patch.message="Updated."
✓ Patch a84ea2e updated to 9fd6bb156bc899aef7119e6d97c6cf850639a7df
✓ Patch 48c3035 updated to 8c15a61af45f561b4bf0694aee03ade34a1b18f5
✓ Synced with 1 node(s)
To rad://zhbMU4DUXrzB8xT6qAJh6yZ7bFMK/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
bdcdb30..cad2666 bob/feature -> patches/a84ea2e8626a86442910a2e70837561538c20efb
bdcdb30..cad2666 bob/feature -> patches/48c30356be83049458c0608d5a6f84789e9dc1d0
```
Alice pulls the update.
``` ~alice
$ rad patch show a84ea2e
$ rad patch show 48c3035
╭─────────────────────────────────────────────────────────────────────╮
│ Title Bob's patch │
│ Patch a84ea2e8626a86442910a2e70837561538c20efb
│ Patch 48c30356be83049458c0608d5a6f84789e9dc1d0
│ Author bob z6Mkt67…v4N1tRk │
│ Head cad2666a8a2250e4dee175ed5044be2c251ff08b │
│ Commits ahead 2, behind 0 │
@ -100,16 +100,16 @@ $ rad patch show a84ea2e
│ bdcdb30 Bob's commit #1
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by bob z6Mkt67…v4N1tRk now │
│ ↑ updated to 9fd6bb156bc899aef7119e6d97c6cf850639a7df (cad2666) now │
│ ↑ updated to 8c15a61af45f561b4bf0694aee03ade34a1b18f5 (cad2666) now │
╰─────────────────────────────────────────────────────────────────────╯
$ git ls-remote rad
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
cad2666a8a2250e4dee175ed5044be2c251ff08b refs/heads/patches/a84ea2e8626a86442910a2e70837561538c20efb
cad2666a8a2250e4dee175ed5044be2c251ff08b refs/heads/patches/48c30356be83049458c0608d5a6f84789e9dc1d0
```
``` ~alice
$ git fetch rad
$ git status --short --branch
## patch/a84ea2e...rad/patches/a84ea2e8626a86442910a2e70837561538c20efb [behind 1]
## patch/48c3035...rad/patches/48c30356be83049458c0608d5a6f84789e9dc1d0 [behind 1]
```
``` ~alice
$ git pull

View File

@ -6,16 +6,16 @@ $ git commit -q -m "Not a real change" --allow-empty
```
``` (stderr)
$ git push rad HEAD:refs/patches
✓ Patch 2541d346ba0b9377b3d38852dfded43f23833fc1 opened
✓ Patch 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
```
$ rad patch show 2541d346ba0b9377b3d38852dfded43f23833fc1
$ rad patch show 8f5dcedc07a89928fd450bce1479f2559bcfd1d4
╭────────────────────────────────────────────────────╮
│ Title Not a real change │
│ Patch 2541d346ba0b9377b3d38852dfded43f23833fc1
│ Patch 8f5dcedc07a89928fd450bce1479f2559bcfd1d4
│ Author z6MknSL…StBU8Vi (you) │
│ Head 51b2f0f77b9849bfaa3e9d3ff68ee2f57771d20c │
│ Branches feature/1 │
@ -46,17 +46,17 @@ Now, instead of using `git push` to update the patch, as we normally would,
we run:
```
$ rad patch update 2541d346ba0b9377b3d38852dfded43f23833fc1 -m "Updated patch"
d9c9ef902f2957d746bb53e744e69a5c3aa564bc
$ rad patch update 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 -m "Updated patch"
74d453f93d81bb535ffa4ef65c46e5bd0a76015d
```
The command outputs the new Revision ID, which we can now see here:
```
$ rad patch show 2541d346ba0b9377b3d38852dfded43f23833fc1
$ rad patch show 8f5dcedc07a89928fd450bce1479f2559bcfd1d4
╭─────────────────────────────────────────────────────────────────────╮
│ Title Not a real change │
│ Patch 2541d346ba0b9377b3d38852dfded43f23833fc1
│ Patch 8f5dcedc07a89928fd450bce1479f2559bcfd1d4
│ Author z6MknSL…StBU8Vi (you) │
│ Head 4d272148458a17620541555b1f0905c01658aa9f │
│ Branches feature/1 │
@ -67,6 +67,6 @@ $ rad patch show 2541d346ba0b9377b3d38852dfded43f23833fc1
│ 51b2f0f Not a real change │
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) now │
│ ↑ updated to d9c9ef902f2957d746bb53e744e69a5c3aa564bc (4d27214) now │
│ ↑ updated to 74d453f93d81bb535ffa4ef65c46e5bd0a76015d (4d27214) now │
╰─────────────────────────────────────────────────────────────────────╯
```

View File

@ -8,7 +8,7 @@ $ git checkout -b feature/1
Switched to a new branch 'feature/1'
$ git commit -a -m "Add things" -q --allow-empty
$ git push -o patch.message="Add things #1" -o patch.message="See commits for details." rad HEAD:refs/patches
✓ Patch e49e64637ab4a29e5a16c73000dacd2afa918d9d opened
✓ Patch 82faae29b2a2f11bf45bbba4c4787d6b32a12447 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -16,10 +16,10 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
We can see a patch was created:
```
$ rad patch show e49e64637ab4a29e5a16c73000dacd2afa918d9d
$ rad patch show 82faae29b2a2f11bf45bbba4c4787d6b32a12447
╭────────────────────────────────────────────────────╮
│ Title Add things #1
│ Patch e49e64637ab4a29e5a16c73000dacd2afa918d9d
│ Patch 82faae29b2a2f11bf45bbba4c4787d6b32a12447
│ Author z6MknSL…StBU8Vi (you) │
│ Head 42d894a83c9c356552a57af09ccdbd5587a99045 │
│ Branches feature/1 │
@ -39,7 +39,7 @@ branch associated with this patch:
```
$ git branch -vv
* feature/1 42d894a [rad/patches/e49e64637ab4a29e5a16c73000dacd2afa918d9d] Add things
* feature/1 42d894a [rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447] Add things
master f2de534 [rad/master] Second commit
```
@ -47,7 +47,7 @@ Let's check that it's up to date with our local head:
```
$ git status --short --branch
## feature/1...rad/patches/e49e64637ab4a29e5a16c73000dacd2afa918d9d
## feature/1...rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447
$ git fetch
$ git push
```
@ -59,14 +59,14 @@ $ git show-ref
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/feature/1
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/remotes/rad/master
42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/e49e64637ab4a29e5a16c73000dacd2afa918d9d
42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447
```
```
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji 'refs/heads/patches/*'
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/patches/e49e64637ab4a29e5a16c73000dacd2afa918d9d
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 'refs/cobs/*'
2317f74de0494c489a233ca6f29f2b8bff6d4f15 refs/cobs/xyz.radicle.id/2317f74de0494c489a233ca6f29f2b8bff6d4f15
e49e64637ab4a29e5a16c73000dacd2afa918d9d refs/cobs/xyz.radicle.patch/e49e64637ab4a29e5a16c73000dacd2afa918d9d
0656c217f917c3e06234771e9ecae53aba5e173e refs/cobs/xyz.radicle.id/0656c217f917c3e06234771e9ecae53aba5e173e
82faae29b2a2f11bf45bbba4c4787d6b32a12447 refs/cobs/xyz.radicle.patch/82faae29b2a2f11bf45bbba4c4787d6b32a12447
```
We can create another patch:
@ -75,7 +75,7 @@ We can create another patch:
$ git checkout -b feature/2 -q master
$ git commit -a -m "Add more things" -q --allow-empty
$ git push rad HEAD:refs/patches
✓ Patch b1fd7b6883dca2ef11e0e486a7097e759ea90cdb opened
✓ Patch b77b2e8a05adcdc859a0184f7db859df1c6686b6 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -84,8 +84,8 @@ We see both branches with upstreams now:
```
$ git branch -vv
feature/1 42d894a [rad/patches/e49e64637ab4a29e5a16c73000dacd2afa918d9d] Add things
* feature/2 8b0ea80 [rad/patches/b1fd7b6883dca2ef11e0e486a7097e759ea90cdb] Add more things
feature/1 42d894a [rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447] Add things
* feature/2 8b0ea80 [rad/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6] Add more things
master f2de534 [rad/master] Second commit
```
@ -96,8 +96,8 @@ $ rad patch
╭───────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Head + - Updated │
├───────────────────────────────────────────────────────────────────────────────┤
│ ● b1fd7b6 Add more things z6MknSL…StBU8Vi (you) 8b0ea80 +0 -0 now │
│ ● e49e646 Add things #1 z6MknSL…StBU8Vi (you) 42d894a +0 -0 now │
│ ● 82faae2 Add things #1 z6MknSL…StBU8Vi (you) 42d894a +0 -0 now │
│ ● b77b2e8 Add more things z6MknSL…StBU8Vi (you) 8b0ea80 +0 -0 now │
╰───────────────────────────────────────────────────────────────────────────────╯
```
@ -109,9 +109,9 @@ $ git commit -a -m "Improve code" -q --allow-empty
``` (stderr)
$ git push
✓ Patch b1fd7b6 updated to c867846b9f294c271e8934820dfac2c5924ecd5a
✓ Patch b77b2e8 updated to 8d6692ce2b2219a54d09ccd5feefedb2bae33eba
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
8b0ea80..02bef3f feature/2 -> patches/b1fd7b6883dca2ef11e0e486a7097e759ea90cdb
8b0ea80..02bef3f feature/2 -> patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6
```
This last `git push` worked without specifying an upstream branch despite the
@ -129,10 +129,10 @@ This allows for pushing to the remote patch branch without using the full
We can then see that the patch head has moved:
```
$ rad patch show b1fd7b6
$ rad patch show b77b2e8
╭─────────────────────────────────────────────────────────────────────╮
│ Title Add more things │
│ Patch b1fd7b6883dca2ef11e0e486a7097e759ea90cdb
│ Patch b77b2e8a05adcdc859a0184f7db859df1c6686b6
│ Author z6MknSL…StBU8Vi (you) │
│ Head 02bef3fac41b2f98bb3c02b868a53ddfecb55b5f │
│ Branches feature/2 │
@ -143,7 +143,7 @@ $ rad patch show b1fd7b6
│ 8b0ea80 Add more things │
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) now │
│ ↑ updated to c867846b9f294c271e8934820dfac2c5924ecd5a (02bef3f) now │
│ ↑ updated to 8d6692ce2b2219a54d09ccd5feefedb2bae33eba (02bef3f) now │
╰─────────────────────────────────────────────────────────────────────╯
```
@ -156,14 +156,14 @@ $ git rev-parse HEAD
```
$ git status --short --branch
## feature/2...rad/patches/b1fd7b6883dca2ef11e0e486a7097e759ea90cdb
## feature/2...rad/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6
```
```
$ git rev-parse refs/remotes/rad/patches/b1fd7b6883dca2ef11e0e486a7097e759ea90cdb
$ git rev-parse refs/remotes/rad/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6
02bef3fac41b2f98bb3c02b868a53ddfecb55b5f
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi refs/heads/patches/b1fd7b6883dca2ef11e0e486a7097e759ea90cdb
02bef3fac41b2f98bb3c02b868a53ddfecb55b5f refs/heads/patches/b1fd7b6883dca2ef11e0e486a7097e759ea90cdb
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi refs/heads/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6
02bef3fac41b2f98bb3c02b868a53ddfecb55b5f refs/heads/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6
```
## Force push
@ -184,7 +184,7 @@ Now let's push to the patch head.
``` (stderr) (fail)
$ git push
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
! [rejected] feature/2 -> patches/b1fd7b6883dca2ef11e0e486a7097e759ea90cdb (non-fast-forward)
! [rejected] feature/2 -> patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 (non-fast-forward)
error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi'
hint: [..]
hint: [..]
@ -197,18 +197,18 @@ use `--force` to force the update.
``` (stderr)
$ git push --force
✓ Patch b1fd7b6 updated to cf4d8577a1ec8aaa21a7ccca67ad8627c3304024
✓ Patch b77b2e8 updated to 8438ab3940316abe65c93982a0a8f39688400359
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ 02bef3f...9304dbc feature/2 -> patches/b1fd7b6883dca2ef11e0e486a7097e759ea90cdb (forced update)
+ 02bef3f...9304dbc feature/2 -> patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 (forced update)
```
That worked. We can see the new revision if we call `rad patch show`:
```
$ rad patch show b1fd7b6
$ rad patch show b77b2e8
╭─────────────────────────────────────────────────────────────────────╮
│ Title Add more things │
│ Patch b1fd7b6883dca2ef11e0e486a7097e759ea90cdb
│ Patch b77b2e8a05adcdc859a0184f7db859df1c6686b6
│ Author z6MknSL…StBU8Vi (you) │
│ Head 9304dbc445925187994a7a93222a3f8bde73b785 │
│ Branches feature/2 │
@ -219,8 +219,8 @@ $ rad patch show b1fd7b6
│ 8b0ea80 Add more things │
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) now │
│ ↑ updated to c867846b9f294c271e8934820dfac2c5924ecd5a (02bef3f) now │
│ ↑ updated to cf4d8577a1ec8aaa21a7ccca67ad8627c3304024 (9304dbc) now │
│ ↑ updated to 8d6692ce2b2219a54d09ccd5feefedb2bae33eba (02bef3f) now │
│ ↑ updated to 8438ab3940316abe65c93982a0a8f39688400359 (9304dbc) now │
╰─────────────────────────────────────────────────────────────────────╯
```

View File

@ -26,7 +26,7 @@ Once the code is ready, we open (or create) a patch with our changes for the pro
``` (stderr)
$ git push rad -o patch.message="Define power requirements" -o patch.message="See details." HEAD:refs/patches
✓ Patch a8926643a8f6a65bc386b0131621994000485d4d opened
✓ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -38,14 +38,14 @@ $ rad patch
╭─────────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Head + - Updated │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ ● a892664 Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │
│ ● 6ff4f09 Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │
╰─────────────────────────────────────────────────────────────────────────────────────────╯
```
```
$ rad patch show a8926643a8f6a65bc386b0131621994000485d4d -p
$ rad patch show 6ff4f09c1b5a81347981f59b02ef43a31a07cdae -p
╭────────────────────────────────────────────────────╮
│ Title Define power requirements │
│ Patch a8926643a8f6a65bc386b0131621994000485d4d
│ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae
│ Author z6MknSL…StBU8Vi (you) │
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
│ Branches flux-capacitor-power │
@ -74,7 +74,7 @@ index 0000000..e69de29
We can also see that it set an upstream for our patch branch:
```
$ git branch -vv
* flux-capacitor-power 3e674d1 [rad/patches/a8926643a8f6a65bc386b0131621994000485d4d] Define power requirements
* flux-capacitor-power 3e674d1 [rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae] Define power requirements
master f2de534 [rad/master] Second commit
```
@ -90,48 +90,48 @@ $ git commit --message "Add README, just for the fun"
```
``` (stderr)
$ git push rad -o patch.message="Add README, just for the fun"
✓ Patch a892664 updated to 8d8aa0887a11f2a37fa8ed0d5723efa96fd727ed
✓ Patch 6ff4f09 updated to 0c0942e2ff2488617d950ede15567ca39a29972e
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
3e674d1..27857ec flux-capacitor-power -> patches/a8926643a8f6a65bc386b0131621994000485d4d
3e674d1..27857ec flux-capacitor-power -> patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae
```
And let's leave a quick comment for our team:
```
$ rad patch comment a8926643a8f6a65bc386b0131621994000485d4d --message 'I cannot wait to get back to the 90s!'
$ rad patch comment 6ff4f09c1b5a81347981f59b02ef43a31a07cdae --message 'I cannot wait to get back to the 90s!'
╭───────────────────────────────────────╮
│ z6MknSL…StBU8Vi (you) now b97a27f
│ z6MknSL…StBU8Vi (you) now cd811db │
│ I cannot wait to get back to the 90s! │
╰───────────────────────────────────────╯
$ rad patch comment a8926643a8f6a65bc386b0131621994000485d4d --message 'My favorite decade!' --reply-to b97a27f -q
a3a462bc8ab52e2a6f3568c28a11ba53cf40bbc8
$ rad patch comment 6ff4f09c1b5a81347981f59b02ef43a31a07cdae --message 'My favorite decade!' --reply-to cd811db -q
b6a76fe394de87eb34cbc3823a0edc80ff98cb97
```
Now, let's checkout the patch that we just created:
```
$ rad patch checkout a892664
✓ Switched to branch patch/a892664
✓ Branch patch/a892664 setup to track rad/patches/a8926643a8f6a65bc386b0131621994000485d4d
$ rad patch checkout 6ff4f09
✓ Switched to branch patch/6ff4f09
✓ Branch patch/6ff4f09 setup to track rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae
```
We can also add a review verdict as such:
```
$ rad review a8926643a8f6a65bc386b0131621994000485d4d --accept --no-message --no-sync
✓ Patch a892664 accepted
$ rad review 6ff4f09c1b5a81347981f59b02ef43a31a07cdae --accept --no-message --no-sync
✓ Patch 6ff4f09 accepted
```
Showing the patch list now will reveal the favorable verdict:
```
$ rad patch show a892664
$ rad patch show 6ff4f09
╭─────────────────────────────────────────────────────────────────────╮
│ Title Define power requirements │
│ Patch a8926643a8f6a65bc386b0131621994000485d4d
│ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae
│ Author z6MknSL…StBU8Vi (you) │
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
│ Branches flux-capacitor-power, patch/a892664 │
│ Branches flux-capacitor-power, patch/6ff4f09
│ Commits ahead 2, behind 0 │
│ Status open │
│ │
@ -141,7 +141,7 @@ $ rad patch show a892664
│ 3e674d1 Define power requirements │
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) now │
│ ↑ updated to 8d8aa0887a11f2a37fa8ed0d5723efa96fd727ed (27857ec) now │
│ ↑ updated to 0c0942e2ff2488617d950ede15567ca39a29972e (27857ec) now │
│ ✓ accepted by z6MknSL…StBU8Vi (you) now │
╰─────────────────────────────────────────────────────────────────────╯
```
@ -149,14 +149,14 @@ $ rad patch show a892664
If you make a mistake on the patch description, you can always change it!
```
$ rad patch edit a892664 --message "Define power requirements" --message "Add requirements file"
$ rad patch show a892664
$ rad patch edit 6ff4f09 --message "Define power requirements" --message "Add requirements file"
$ rad patch show 6ff4f09
╭─────────────────────────────────────────────────────────────────────╮
│ Title Define power requirements │
│ Patch a8926643a8f6a65bc386b0131621994000485d4d
│ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae
│ Author z6MknSL…StBU8Vi (you) │
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
│ Branches flux-capacitor-power, patch/a892664 │
│ Branches flux-capacitor-power, patch/6ff4f09
│ Commits ahead 2, behind 0 │
│ Status open │
│ │
@ -166,7 +166,7 @@ $ rad patch show a892664
│ 3e674d1 Define power requirements │
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by z6MknSL…StBU8Vi (you) now │
│ ↑ updated to 8d8aa0887a11f2a37fa8ed0d5723efa96fd727ed (27857ec) now │
│ ↑ updated to 0c0942e2ff2488617d950ede15567ca39a29972e (27857ec) now │
│ ✓ accepted by z6MknSL…StBU8Vi (you) now │
╰─────────────────────────────────────────────────────────────────────╯
```

View File

@ -61,7 +61,7 @@ $ git commit -q -m "Update files"
``` (stderr)
$ git push rad HEAD:refs/patches
✓ Patch 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2 opened
✓ Patch 52da8356aa9beec08e6943cb3c4063fa37f3241b opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@ -70,7 +70,7 @@ Finally, we do a review of the patch by hunk. The output of this command should
match `git diff master -W100% -U5 --patience`:
```
$ rad review --no-sync --patch -U5 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
$ rad review --no-sync --patch -U5 52da8356aa9beec08e6943cb3c4063fa37f3241b
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 7937fb3..0000000
@ -116,8 +116,8 @@ rename to notes/INSTRUCTIONS.txt
Now let's accept these hunks one by one..
```
$ rad review --no-sync --patch --accept --hunk 1 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
✓ Loaded existing review ([..]) for patch 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
$ rad review --no-sync --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b
✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 7937fb3..0000000
@ -127,8 +127,8 @@ index 7937fb3..0000000
-*.draft
```
```
$ rad review --no-sync --patch --accept --hunk 1 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
✓ Loaded existing review ([..]) for patch 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
$ rad review --no-sync --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b
✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b
diff --git a/DISCLAIMER.txt b/DISCLAIMER.txt
new file mode 100644
index 0000000..2b5bd86
@ -138,8 +138,8 @@ index 0000000..2b5bd86
+All food is served as-is, with no warranty!
```
```
$ rad review --no-sync --patch --accept -U3 --hunk 1 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
✓ Loaded existing review ([..]) for patch 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
$ rad review --no-sync --patch --accept -U3 --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b
✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b
diff --git a/MENU.txt b/MENU.txt
index 867958c..3af9741 100644
--- a/MENU.txt
@ -153,8 +153,8 @@ index 867958c..3af9741 100644
[..]
```
```
$ rad review --no-sync --patch --accept -U3 --hunk 1 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
✓ Loaded existing review ([..]) for patch 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
$ rad review --no-sync --patch --accept -U3 --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b
✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b
diff --git a/MENU.txt b/MENU.txt
index 4e2e828..3af9741 100644
--- a/MENU.txt
@ -169,8 +169,8 @@ index 4e2e828..3af9741 100644
```
```
$ rad review --no-sync --patch --accept --hunk 1 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
✓ Loaded existing review ([..]) for patch 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
$ rad review --no-sync --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b
✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b
diff --git a/INSTRUCTIONS.txt b/notes/INSTRUCTIONS.txt
similarity index 100%
rename from INSTRUCTIONS.txt
@ -178,7 +178,7 @@ rename to notes/INSTRUCTIONS.txt
```
```
$ rad review --no-sync --patch --accept --hunk 1 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
✓ Loaded existing review ([..]) for patch 4f4fdb0fbb3327975b92fd1fa88e7427b1b141e2
$ rad review --no-sync --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b
✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b
✓ All hunks have been reviewed
```

View File

@ -7,7 +7,7 @@ Let's say the new car you are designing with your peers has a problem with its f
$ rad issue open --title "flux capacitor underpowered" --description "Flux capacitor power requirements exceed current supply" --no-announce
╭─────────────────────────────────────────────────────────╮
│ Title flux capacitor underpowered │
│ Issue b0c5579944e37d0bf3455bf1cec9c91596c6f47a
│ Issue d0609890491d8b1892cb6229155508967418eafd
│ Author bob (you) │
│ Status open │
│ │
@ -22,7 +22,7 @@ $ rad issue list
╭──────────────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Labels Assignees Opened │
├──────────────────────────────────────────────────────────────────────────────────────────┤
│ ● b0c5579 flux capacitor underpowered bob (you) now │
│ ● d060989 flux capacitor underpowered bob (you) now │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
```
@ -31,6 +31,6 @@ found an important detail about the car's power requirements. It will help
whoever works on a fix.
```
$ rad issue comment b0c5579944e37d0bf3455bf1cec9c91596c6f47a --message 'The flux capacitor needs 1.21 Gigawatts' -q
c45d2acdd1de992c0127fd44519b8a5260695497
$ rad issue comment d0609890491d8b1892cb6229155508967418eafd --message 'The flux capacitor needs 1.21 Gigawatts' -q
df9b63af142250fc1d0ee7dc4f82ae23d55d3250
```

View File

@ -26,7 +26,7 @@ Once the code is ready, we open a patch with our changes.
``` (stderr)
$ git push rad -o no-sync -o patch.message="Define power requirements" -o patch.message="See details." HEAD:refs/patches
✓ Patch f5e2be41827ee9f80bcdcd02f4f0451287b36229 opened
✓ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
* [new reference] HEAD -> refs/patches
```
@ -38,12 +38,12 @@ $ rad patch
╭────────────────────────────────────────────────────────────────────────────────╮
│ ● ID Title Author Head + - Updated │
├────────────────────────────────────────────────────────────────────────────────┤
│ ● f5e2be4 Define power requirements bob (you) 3e674d1 +0 -0 now │
│ ● 3581e83 Define power requirements bob (you) 3e674d1 +0 -0 now │
╰────────────────────────────────────────────────────────────────────────────────╯
$ rad patch show f5e2be41827ee9f80bcdcd02f4f0451287b36229
$ rad patch show 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
╭────────────────────────────────────────────────────╮
│ Title Define power requirements │
│ Patch f5e2be41827ee9f80bcdcd02f4f0451287b36229
│ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
│ Author bob (you) │
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
│ Branches flux-capacitor-power │
@ -62,7 +62,7 @@ We can also confirm that the patch branch is in storage:
```
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk refs/heads/patches/*
3e674d1a1df90807e934f9ae5da2591dd6848a33 refs/heads/patches/f5e2be41827ee9f80bcdcd02f4f0451287b36229
3e674d1a1df90807e934f9ae5da2591dd6848a33 refs/heads/patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
```
Wait, let's add a README too! Just for fun.
@ -77,14 +77,14 @@ $ git commit --message "Add README, just for the fun"
```
``` (stderr) RAD_SOCKET=/dev/null
$ git push -o patch.message="Add README, just for the fun"
✓ Patch f5e2be4 updated to 68143c579935d115e1551b88154cc41763c43e1f
✓ Patch 3581e83 updated to 6de8527cdf51f96e12649c7278efe1dccfdee885
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
3e674d1..27857ec flux-capacitor-power -> patches/f5e2be41827ee9f80bcdcd02f4f0451287b36229
3e674d1..27857ec flux-capacitor-power -> patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
```
And let's leave a quick comment for our team:
```
$ rad patch comment f5e2be41827ee9f80bcdcd02f4f0451287b36229 --message 'I cannot wait to get back to the 90s!' -q
9b12eacdf5d326bdd16ed971809a9a88268ca435
$ rad patch comment 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c --message 'I cannot wait to get back to the 90s!' -q
b6711a58b45323f3ef2bb87cfb2b3b4d04c22a8b
```

View File

@ -22,7 +22,7 @@ $ git fetch bob
✓ Synced with 1 peer(s)
From rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
* [new branch] master -> bob/master
* [new branch] patches/f5e2be41827ee9f80bcdcd02f4f0451287b36229 -> bob/patches/f5e2be41827ee9f80bcdcd02f4f0451287b36229
* [new branch] patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c -> bob/patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
```
The contributor's changes are now visible to us.
@ -30,12 +30,12 @@ The contributor's changes are now visible to us.
```
$ git branch -r
bob/master
bob/patches/f5e2be41827ee9f80bcdcd02f4f0451287b36229
bob/patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
rad/master
$ rad patch show f5e2be4
$ rad patch show 3581e83
╭─────────────────────────────────────────────────────────────────────╮
│ Title Define power requirements │
│ Patch f5e2be41827ee9f80bcdcd02f4f0451287b36229
│ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
│ Author bob z6Mkt67…v4N1tRk │
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
│ Commits ahead 2, behind 0 │
@ -47,7 +47,7 @@ $ rad patch show f5e2be4
│ 3e674d1 Define power requirements │
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by bob z6Mkt67…v4N1tRk now │
│ ↑ updated to 68143c579935d115e1551b88154cc41763c43e1f (27857ec) now │
│ ↑ updated to 6de8527cdf51f96e12649c7278efe1dccfdee885 (27857ec) now │
╰─────────────────────────────────────────────────────────────────────╯
```
@ -57,20 +57,20 @@ way will tell others about the corrections we needed before merging the
changes.
```
$ rad patch checkout f5e2be41827ee9f80bcdcd02f4f0451287b36229
✓ Switched to branch patch/f5e2be4
✓ Branch patch/f5e2be4 setup to track rad/patches/f5e2be41827ee9f80bcdcd02f4f0451287b36229
$ rad patch checkout 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
✓ Switched to branch patch/3581e83
✓ Branch patch/3581e83 setup to track rad/patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
$ git mv REQUIREMENTS REQUIREMENTS.md
$ git commit -m "Use markdown for requirements"
[patch/f5e2be4 f567f69] Use markdown for requirements
[patch/3581e83 f567f69] Use markdown for requirements
1 file changed, 0 insertions(+), 0 deletions(-)
rename REQUIREMENTS => REQUIREMENTS.md (100%)
```
``` (stderr)
$ git push rad -o no-sync -o patch.message="Use markdown for requirements"
✓ Patch f5e2be4 updated to 5dd1e6b73aa8c2dbfa192f8cf47cd1525c602ebf
✓ Patch 3581e83 updated to abb0360eae315bbd460743381303567587ab0e08
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new branch] patch/f5e2be4 -> patches/f5e2be41827ee9f80bcdcd02f4f0451287b36229
* [new branch] patch/3581e83 -> patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
```
Great, all fixed up, lets merge the code.
@ -78,7 +78,7 @@ Great, all fixed up, lets merge the code.
```
$ git checkout master
Your branch is up to date with 'rad/master'.
$ git merge patch/f5e2be4
$ git merge patch/3581e83
Updating f2de534..f567f69
Fast-forward
README.md | 0
@ -89,7 +89,7 @@ Fast-forward
```
``` (stderr)
$ git push rad master
✓ Patch f5e2be41827ee9f80bcdcd02f4f0451287b36229 merged at revision 5dd1e6b
✓ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c merged at revision abb0360
✓ Synced with 1 node(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..f567f69 master -> master
@ -98,10 +98,10 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
The patch is now merged and closed :).
```
$ rad patch show f5e2be4
$ rad patch show 3581e83
╭─────────────────────────────────────────────────────────────────────╮
│ Title Define power requirements │
│ Patch f5e2be41827ee9f80bcdcd02f4f0451287b36229
│ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c
│ Author bob z6Mkt67…v4N1tRk │
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
│ Commits ahead 0, behind 1 │
@ -113,9 +113,9 @@ $ rad patch show f5e2be4
│ 3e674d1 Define power requirements │
├─────────────────────────────────────────────────────────────────────┤
│ ● opened by bob z6Mkt67…v4N1tRk now │
│ ↑ updated to 68143c579935d115e1551b88154cc41763c43e1f (27857ec) now │
│ * revised by alice (you) in 5dd1e6b (f567f69) now │
│ ✓ merged by alice (you) at revision 5dd1e6b (f567f69) now │
│ ↑ updated to 6de8527cdf51f96e12649c7278efe1dccfdee885 (27857ec) now │
│ * revised by alice (you) in abb0360 (f567f69) now │
│ ✓ merged by alice (you) at revision abb0360 (f567f69) now │
╰─────────────────────────────────────────────────────────────────────╯
```

View File

@ -1980,7 +1980,7 @@ mod routes {
#[tokio::test]
async fn test_projects_issues_create() {
const CREATED_ISSUE_ID: &str = "8b42657072f6192cba9e08561582576a975656cd";
const CREATED_ISSUE_ID: &str = "b2d0999498f98b0d1fa12d859d2d0306380333a0";
let tmp = tempfile::tempdir().unwrap();
let ctx = contributor(tmp.path());
@ -2075,20 +2075,24 @@ mod routes {
"content": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4//8/AAX+Av4N70a4AAAAAElFTkSuQmCC"
}
],
"replyTo": CONTRIBUTOR_ISSUE_ID,
"replyTo": ISSUE_DISCUSSION_ID,
}))
.unwrap();
let response = patch(
&app,
format!("/projects/{CONTRIBUTOR_RID}/issues/{CONTRIBUTOR_ISSUE_ID}"),
format!("/projects/{CONTRIBUTOR_RID}/issues/{ISSUE_DISCUSSION_ID}"),
Some(Body::from(body)),
Some(SESSION_ID.to_string()),
)
.await;
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(response.success().await, true);
// Get ID to redact later in the test
let response = response.json().await;
let id = &response["id"];
assert!(id.is_string());
let body = serde_json::to_vec(&json!({
"type": "comment.react",
@ -2099,7 +2103,7 @@ mod routes {
.unwrap();
patch(
&app,
format!("/projects/{CONTRIBUTOR_RID}/issues/{CONTRIBUTOR_ISSUE_ID}"),
format!("/projects/{CONTRIBUTOR_RID}/issues/{ISSUE_DISCUSSION_ID}"),
Some(Body::from(body)),
Some(SESSION_ID.to_string()),
)
@ -2120,23 +2124,23 @@ mod routes {
let response = patch(
&app,
format!("/projects/{CONTRIBUTOR_RID}/issues/{CONTRIBUTOR_ISSUE_ID}"),
format!("/projects/{CONTRIBUTOR_RID}/issues/{ISSUE_DISCUSSION_ID}"),
Some(Body::from(body)),
Some(SESSION_ID.to_string()),
)
.await;
.await;
assert_eq!(response.success().await, true);
let body = serde_json::to_vec(&json!({
"type": "comment.redact",
"id": "918fff44966e4305523c077c80ac93b1196f1a7e",
"id": id.as_str().unwrap(),
}))
.unwrap();
let response = patch(
&app,
format!("/projects/{CONTRIBUTOR_RID}/issues/{CONTRIBUTOR_ISSUE_ID}"),
format!("/projects/{CONTRIBUTOR_RID}/issues/{ISSUE_DISCUSSION_ID}"),
Some(Body::from(body)),
Some(SESSION_ID.to_string()),
)
@ -2146,14 +2150,14 @@ mod routes {
let response = get(
&app,
format!("/projects/{CONTRIBUTOR_RID}/issues/{CONTRIBUTOR_ISSUE_ID}"),
format!("/projects/{CONTRIBUTOR_RID}/issues/{ISSUE_DISCUSSION_ID}"),
)
.await;
assert_eq!(
response.json().await,
json!({
"id": CONTRIBUTOR_ISSUE_ID,
"id": ISSUE_DISCUSSION_ID,
"author": {
"id": CONTRIBUTOR_DID,
},
@ -2215,7 +2219,7 @@ mod routes {
let _ = get(&app, format!("/projects/{CONTRIBUTOR_RID}/issues")).await;
let response = patch(
&app,
format!("/projects/{CONTRIBUTOR_RID}/issues/{CONTRIBUTOR_ISSUE_ID}"),
format!("/projects/{CONTRIBUTOR_RID}/issues/{ISSUE_DISCUSSION_ID}"),
Some(Body::from(body)),
Some(SESSION_ID.to_string()),
)
@ -2226,14 +2230,14 @@ mod routes {
let response = get(
&app,
format!("/projects/{CONTRIBUTOR_RID}/issues/{CONTRIBUTOR_ISSUE_ID}"),
format!("/projects/{CONTRIBUTOR_RID}/issues/{ISSUE_DISCUSSION_ID}"),
)
.await;
assert_eq!(
response.json().await,
json!({
"id": CONTRIBUTOR_ISSUE_ID,
"id": ISSUE_DISCUSSION_ID,
"author": {
"id": CONTRIBUTOR_DID,
},
@ -2366,7 +2370,7 @@ mod routes {
#[tokio::test]
async fn test_projects_create_patches() {
const CREATED_PATCH_ID: &str = "beaed2e1d3b9b01ef10326a9a1c951799ba5fb25";
const CREATED_PATCH_ID: &str = "e546f1784df29d0ffd424021ebae556cbd950993";
let tmp = tempfile::tempdir().unwrap();
let ctx = contributor(tmp.path());
@ -2615,10 +2619,10 @@ mod routes {
"revisions": [
{
"id": CONTRIBUTOR_PATCH_ID,
"description": "change `hello world` in README to something else",
"author": {
"id": CONTRIBUTOR_DID,
},
"description": "change `hello world` in README to something else",
"base": PARENT,
"oid": HEAD,
"refs": [
@ -2629,7 +2633,7 @@ mod routes {
"reviews": [],
},
{
"id": "341ba93c6db54e5891fbd3be4a4f64f4715681fa",
"id": "50d760ccbcfadddd81fe32bd94283cbfd80133fa",
"author": {
"id": CONTRIBUTOR_DID,
},

View File

@ -34,23 +34,26 @@ pub const HEAD: &str = "e8c676b9e3b42308dc9d218b70faa5408f8e58ca";
pub const PARENT: &str = "ee8d6a29304623a78ebfa5eeed5af674d0e58f83";
pub const INITIAL_COMMIT: &str = "f604ce9fd5b7cc77b7609beda45ea8760bee78f7";
pub const DID: &str = "did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi";
pub const ISSUE_ID: &str = "4f98396a1ac987af59ec069de9b80d9917b27050";
pub const ISSUE_DISCUSSION_ID: &str = "ceafc6629ec8dc0a17644fb5a66726aaafc3ed1c";
pub const ISSUE_COMMENT_ID: &str = "ca48480f3de728ffca0861538310c6a9704a73b7";
pub const ISSUE_ID: &str = "45d118885b6b06360ee539573f5ceb24be2979f8";
pub const ISSUE_DISCUSSION_ID: &str = "d11b03464c9bf58b09460713c8e2c74f0725d3bd";
pub const ISSUE_COMMENT_ID: &str = "e3aa754cb47d2299781fed49cc91c4b41e06c219";
pub const SESSION_ID: &str = "u9MGAkkfkMOv0uDDB2WeUHBT7HbsO2Dy";
pub const TIMESTAMP: u64 = 1671125284;
pub const CONTRIBUTOR_RID: &str = "rad:z4XaCmN3jLSeiMvW15YTDpNbDHFhG";
pub const CONTRIBUTOR_DID: &str = "did:key:z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8";
pub const CONTRIBUTOR_NID: &str = "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8";
pub const CONTRIBUTOR_ISSUE_ID: &str = "ceafc6629ec8dc0a17644fb5a66726aaafc3ed1c";
pub const CONTRIBUTOR_PATCH_ID: &str = "4ff2ec53a2d165da7f54705023e847d4f9230bc3";
pub const CONTRIBUTOR_PATCH_ID: &str = "0867c6389ee073304da0854a83885f47b1d7f5ed";
/// Create a new profile.
pub fn profile(home: &Path, seed: [u8; 32]) -> radicle::Profile {
let home = Home::new(home).unwrap();
let storage = Storage::open(home.storage()).unwrap();
let keystore = Keystore::new(&home.keys());
let keypair = KeyPair::from_seed(Seed::from(seed));
let alias = node::Alias::new("seed");
let storage = Storage::open(home.storage(), radicle::git::UserInfo {
alias: alias.clone(),
key: keypair.pk.into(),
}).unwrap();
radicle::storage::git::transport::local::register(storage.clone());
keystore.store(keypair.clone(), "radicle", None).unwrap();
@ -61,7 +64,7 @@ pub fn profile(home: &Path, seed: [u8; 32]) -> radicle::Profile {
keystore,
public_key: keypair.pk.into(),
config: profile::Config {
node: node::Config::new(node::Alias::new("seed")),
node: node::Config::new(alias),
},
}
}

View File

@ -136,7 +136,13 @@ impl Runtime {
let network = config.network;
let rng = fastrand::Rng::new();
let clock = LocalTime::now();
let storage = Storage::open(home.storage())?;
let storage = Storage::open(
home.storage(),
git::UserInfo {
alias: alias.clone(),
key: id,
},
)?;
let address_db = node_dir.join(ADDRESS_DB_FILE);
let routing_db = node_dir.join(ROUTING_DB_FILE);
let tracking_db = node_dir.join(TRACKING_DB_FILE);

View File

@ -107,12 +107,19 @@ impl Environment {
/// This should be used when a running node is not required.
pub fn profile(&mut self, alias: &str) -> Profile {
let home = Home::new(self.tmp().join("home").join(alias).join(".radicle")).unwrap();
let storage = Storage::open(home.storage()).unwrap();
let keystore = Keystore::new(&home.keys());
let keypair = KeyPair::from_seed(Seed::from([!(self.users as u8); 32]));
let tracking_db = home.node().join(TRACKING_DB_FILE);
let alias = Alias::from_str(alias).unwrap();
let config = profile::Config::init(alias, &home.config()).unwrap();
let config = profile::Config::init(alias.clone(), &home.config()).unwrap();
let storage = Storage::open(
home.storage(),
git::UserInfo {
alias,
key: keypair.pk.into(),
},
)
.unwrap();
tracking::Config::open(tracking_db).unwrap();
let addresses_db = home.node().join(ADDRESS_DB_FILE);
@ -329,7 +336,14 @@ impl Node<MockSigner> {
);
let home = Home::new(home).unwrap();
let signer = MockSigner::default();
let storage = Storage::open(home.storage()).unwrap();
let storage = Storage::open(
home.storage(),
git::UserInfo {
alias: config.alias.clone(),
key: *signer.public_key(),
},
)
.unwrap();
let addresses = home.addresses_mut().unwrap();
let tracking = home.tracking_mut().unwrap();
let routing = home.routing_mut().unwrap();

View File

@ -249,7 +249,7 @@ fn test_inventory_sync() {
let mut alice = Peer::config(
"alice",
[7, 7, 7, 7],
Storage::open(tmp.path().join("alice")).unwrap(),
Storage::open(tmp.path().join("alice"), fixtures::user()).unwrap(),
peer::Config::default(),
);
let bob_signer = MockSigner::default();
@ -631,13 +631,13 @@ fn test_refs_announcement_relay() {
let mut alice = Peer::config(
"alice",
[7, 7, 7, 7],
Storage::open(tmp.path().join("alice")).unwrap(),
Storage::open(tmp.path().join("alice"), fixtures::user()).unwrap(),
peer::Config::default(),
);
let eve = Peer::config(
"eve",
[8, 8, 8, 8],
Storage::open(tmp.path().join("eve")).unwrap(),
Storage::open(tmp.path().join("eve"), fixtures::user()).unwrap(),
peer::Config::default(),
);
@ -703,7 +703,7 @@ fn test_refs_announcement_fetch_trusted_no_inventory() {
let mut alice = Peer::config(
"alice",
[7, 7, 7, 7],
Storage::open(tmp.path().join("alice")).unwrap(),
Storage::open(tmp.path().join("alice"), fixtures::user()).unwrap(),
peer::Config::default(),
);
let bob = {
@ -1202,7 +1202,7 @@ fn test_queued_fetch() {
#[test]
fn test_refs_synced_event() {
let temp = tempfile::tempdir().unwrap();
let storage = Storage::open(temp.path()).unwrap();
let storage = Storage::open(temp.path(), fixtures::user()).unwrap();
let mut alice = Peer::with_storage("alice", [8, 8, 8, 8], storage);
let bob = Peer::new("eve", [9, 9, 9, 9]);
let acme = alice.project("acme", "");
@ -1246,7 +1246,11 @@ fn test_refs_synced_event() {
fn test_push_and_pull() {
let tempdir = tempfile::tempdir().unwrap();
let storage_alice = Storage::open(tempdir.path().join("alice").join("storage")).unwrap();
let storage_alice = Storage::open(
tempdir.path().join("alice").join("storage"),
fixtures::user(),
)
.unwrap();
let (repo, _) = fixtures::repository(tempdir.path().join("working"));
let mut alice = Peer::config(
"alice",
@ -1255,10 +1259,12 @@ fn test_push_and_pull() {
peer::Config::default(),
);
let storage_bob = Storage::open(tempdir.path().join("bob").join("storage")).unwrap();
let storage_bob =
Storage::open(tempdir.path().join("bob").join("storage"), fixtures::user()).unwrap();
let mut bob = Peer::config("bob", [8, 8, 8, 8], storage_bob, peer::Config::default());
let storage_eve = Storage::open(tempdir.path().join("eve").join("storage")).unwrap();
let storage_eve =
Storage::open(tempdir.path().join("eve").join("storage"), fixtures::user()).unwrap();
let mut eve = Peer::config("eve", [9, 9, 9, 9], storage_eve, peer::Config::default());
remote::mock::register(&alice.node_id(), alice.storage().path());

View File

@ -1262,7 +1262,7 @@ mod test {
eve.repo.fetch(bob);
eve_identity.reload().unwrap();
assert_eq!(eve_identity.timeline, vec![a0, a1, a2.id, b1, e1.id]);
assert_eq!(eve_identity.timeline, vec![a0, a1, a2.id, e1.id, b1]);
assert!(!eve_identity.is_delegate(eve.signer.public_key()));
}
@ -1316,7 +1316,7 @@ mod test {
eve.repo.fetch(bob);
eve_identity.reload().unwrap();
assert_eq!(eve_identity.timeline, vec![a0, a1, a2.id, b1, e1, e2.id]);
assert_eq!(eve_identity.timeline, vec![a0, a1, a2.id, e1, b1, e2.id]);
// Her revision is there, although stale, since another revision was accepted since.
// However, it wasn't pruned, even though rejecting an accepted revision is an error.
@ -1346,7 +1346,6 @@ mod test {
.unwrap();
bob.repo.fetch(alice);
eve.repo.fetch(bob); // TODO: Why is this needed for it not to panic?
eve.repo.fetch(alice);
let mut bob_identity = Identity::load_mut(&*bob.repo).unwrap();
@ -1384,7 +1383,7 @@ mod test {
eve.repo.fetch(alice);
eve_identity.reload().unwrap();
assert_eq!(eve_identity.timeline, vec![a0, a1.id, b1.id, a2, e1.id]);
assert_eq!(eve_identity.timeline, vec![a0, a1.id, b1.id, e1.id, a2]);
assert_eq!(eve_identity.revision(&e1.id).unwrap().state, State::Stale);
}
@ -1397,7 +1396,7 @@ mod test {
let bob = MockSigner::new(&mut rng);
let eve = MockSigner::new(&mut rng);
let storage = Storage::open(tempdir.path().join("storage")).unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
let (id, _, _, _) =
fixtures::project(tempdir.path().join("copy"), &storage, &alice).unwrap();

View File

@ -449,7 +449,7 @@ mod test {
#[test]
fn test_canonical_example() {
let tempdir = tempfile::tempdir().unwrap();
let storage = Storage::open(tempdir.path().join("storage")).unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
transport::local::register(storage.clone());
@ -480,7 +480,7 @@ mod test {
#[test]
fn test_not_found() {
let tempdir = tempfile::tempdir().unwrap();
let storage = Storage::open(tempdir.path().join("storage")).unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
let remote = arbitrary::gen::<RemoteId>(1);
let proj = arbitrary::gen::<Id>(1);
let repo = storage.create(proj).unwrap();
@ -496,7 +496,7 @@ mod test {
#[test]
fn test_canonical_doc() {
let tempdir = tempfile::tempdir().unwrap();
let storage = Storage::open(tempdir.path().join("storage")).unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
transport::local::register(storage.clone());
let (working, _) = fixtures::repository(tempdir.path().join("working"));

View File

@ -20,12 +20,12 @@ use thiserror::Error;
use crate::crypto::ssh::agent::Agent;
use crate::crypto::ssh::{keystore, Keystore, Passphrase};
use crate::crypto::{PublicKey, Signer};
use crate::node;
use crate::node::{address, routing, tracking, Alias, AliasStore};
use crate::prelude::Did;
use crate::prelude::NodeId;
use crate::storage::git::transport;
use crate::storage::git::Storage;
use crate::{git, node};
/// Environment variables used by radicle.
pub mod env {
@ -167,10 +167,16 @@ pub struct Profile {
impl Profile {
pub fn init(home: Home, alias: Alias, passphrase: Option<Passphrase>) -> Result<Self, Error> {
let storage = Storage::open(home.storage())?;
let keystore = Keystore::new(&home.keys());
let public_key = keystore.init("radicle", passphrase)?;
let config = Config::init(alias, home.config().as_path())?;
let config = Config::init(alias.clone(), home.config().as_path())?;
let storage = Storage::open(
home.storage(),
git::UserInfo {
alias,
key: public_key,
},
)?;
transport::local::register(storage.clone());
@ -185,12 +191,18 @@ impl Profile {
pub fn load() -> Result<Self, Error> {
let home = self::home()?;
let storage = Storage::open(home.storage())?;
let keystore = Keystore::new(&home.keys());
let public_key = keystore
.public_key()?
.ok_or_else(|| Error::NotFound(home.path().to_path_buf()))?;
let config = Config::load(home.config().as_path())?;
let storage = Storage::open(
home.storage(),
git::UserInfo {
alias: config.alias().clone(),
key: public_key,
},
)?;
transport::local::register(storage.clone());
@ -207,6 +219,13 @@ impl Profile {
&self.public_key
}
pub fn info(&self) -> git::UserInfo {
git::UserInfo {
alias: self.config.alias().clone(),
key: *self.id(),
}
}
pub fn did(&self) -> Did {
Did::from(self.public_key)
}

View File

@ -369,7 +369,7 @@ mod tests {
let tempdir = tempfile::tempdir().unwrap();
let signer = MockSigner::default();
let public_key = *signer.public_key();
let storage = Storage::open(tempdir.path().join("storage")).unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
transport::local::register(storage.clone());
@ -423,7 +423,7 @@ mod tests {
let alice = MockSigner::new(&mut rng);
let bob = MockSigner::new(&mut rng);
let bob_id = bob.public_key();
let storage = Storage::open(tempdir.path().join("storage")).unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
transport::local::register(storage.clone());
@ -460,7 +460,7 @@ mod tests {
let tempdir = tempfile::tempdir().unwrap();
let signer = MockSigner::default();
let remote_id = signer.public_key();
let storage = Storage::open(tempdir.path().join("storage")).unwrap();
let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
transport::local::register(storage.clone());

View File

@ -313,6 +313,8 @@ impl<V> Deref for Remote<V> {
pub trait ReadStorage {
type Repository: ReadRepository;
/// Get user info for this storage.
fn info(&self) -> &UserInfo;
/// Get the storage base path.
fn path(&self) -> &Path;
/// Get a repository's path.
@ -538,6 +540,10 @@ where
{
type Repository = S::Repository;
fn info(&self) -> &UserInfo {
self.deref().info()
}
fn path(&self) -> &Path {
self.deref().path()
}

View File

@ -81,11 +81,16 @@ impl<'a> TryFrom<git2::Reference<'a>> for Ref {
#[derive(Debug, Clone)]
pub struct Storage {
path: PathBuf,
info: UserInfo,
}
impl ReadStorage for Storage {
type Repository = Repository;
fn info(&self) -> &UserInfo {
&self.info
}
fn path(&self) -> &Path {
self.path.as_path()
}
@ -125,7 +130,7 @@ impl WriteStorage for Storage {
}
fn create(&self, rid: Id) -> Result<Self::RepositoryMut, Error> {
Repository::create(paths::repository(self, &rid), rid)
Repository::create(paths::repository(self, &rid), rid, &self.info)
}
fn remove(&self, rid: Id) -> Result<(), Error> {
@ -135,7 +140,7 @@ impl WriteStorage for Storage {
impl Storage {
// TODO: Return a better error when not found.
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, io::Error> {
pub fn open<P: AsRef<Path>>(path: P, info: UserInfo) -> Result<Self, io::Error> {
let path = path.as_ref().to_path_buf();
match fs::create_dir_all(&path) {
@ -144,7 +149,7 @@ impl Storage {
Ok(()) => {}
}
Ok(Self { path })
Ok(Self { path, info })
}
pub fn path(&self) -> &Path {
@ -286,7 +291,7 @@ impl Repository {
}
/// Create a new repository.
pub fn create<P: AsRef<Path>>(path: P, id: Id) -> Result<Self, Error> {
pub fn create<P: AsRef<Path>>(path: P, id: Id, info: &UserInfo) -> Result<Self, Error> {
let backend = git2::Repository::init_opts(
&path,
git2::RepositoryInitOptions::new()
@ -296,9 +301,8 @@ impl Repository {
)?;
let mut config = backend.config()?;
// TODO: Get ahold of user name and/or key.
config.set_str("user.name", "radicle")?;
config.set_str("user.email", "radicle@localhost")?;
config.set_str("user.name", &info.name())?;
config.set_str("user.email", &info.email())?;
Ok(Self { id, backend })
}
@ -320,7 +324,7 @@ impl Repository {
) -> Result<(Self, git::Oid), RepositoryError> {
let (doc_oid, _) = doc.encode()?;
let id = Id::from(doc_oid);
let repo = Self::create(paths::repository(&storage, &id), id)?;
let repo = Self::create(paths::repository(&storage, &id), id, storage.info())?;
let commit = doc.init(&repo, signer)?;
Ok((repo, commit))
@ -1116,7 +1120,7 @@ mod tests {
fn test_references_of() {
let tmp = tempfile::tempdir().unwrap();
let signer = MockSigner::default();
let storage = Storage::open(tmp.path().join("storage")).unwrap();
let storage = Storage::open(tmp.path().join("storage"), fixtures::user()).unwrap();
transport::local::register(storage.clone());
@ -1145,7 +1149,7 @@ mod tests {
let tmp = tempfile::tempdir().unwrap();
let mut rng = fastrand::Rng::new();
let signer = MockSigner::new(&mut rng);
let storage = Storage::open(tmp.path()).unwrap();
let storage = Storage::open(tmp.path(), fixtures::user()).unwrap();
let proj_id = arbitrary::gen::<Id>(1);
let alice = *signer.public_key();
let project = storage.create(proj_id).unwrap();

View File

@ -95,16 +95,23 @@ pub mod setup {
fn default() -> Self {
let root = tempfile::tempdir().unwrap();
Self::new(root, MockSigner::default())
Self::new(root, MockSigner::default(), "Radcliff")
}
}
impl Node {
pub fn new(root: impl AsRef<Path>, signer: MockSigner) -> Self {
pub fn new(root: impl AsRef<Path>, signer: MockSigner, alias: &str) -> Self {
let root = root.as_ref().to_path_buf();
let home = root.join("home");
let paths = Home::new(home.as_path()).unwrap();
let storage = Storage::open(paths.storage()).unwrap();
let storage = Storage::open(
paths.storage(),
git::UserInfo {
alias: Alias::new(alias),
key: *signer.public_key(),
},
)
.unwrap();
remote::mock::register(signer.public_key(), storage.path());
@ -243,9 +250,21 @@ pub mod setup {
impl Default for Network {
fn default() -> Self {
let tmp = tempfile::tempdir().unwrap();
let alice = Node::new(tmp.path().join("alice"), MockSigner::from_seed([!0; 32]));
let mut bob = Node::new(tmp.path().join("bob"), MockSigner::from_seed([!1; 32]));
let mut eve = Node::new(tmp.path().join("eve"), MockSigner::from_seed([!2; 32]));
let alice = Node::new(
tmp.path().join("alice"),
MockSigner::from_seed([!0; 32]),
"alice",
);
let mut bob = Node::new(
tmp.path().join("bob"),
MockSigner::from_seed([!1; 32]),
"bob",
);
let mut eve = Node::new(
tmp.path().join("eve"),
MockSigner::from_seed([!2; 32]),
"eve",
);
let repo = alice.project();
let rid = repo.id;

View File

@ -1,9 +1,11 @@
use std::path::Path;
use std::str::FromStr;
use crate::crypto::{Signer, Verified};
use crate::crypto::{PublicKey, Signer, Verified};
use crate::git;
use crate::identity::doc::Visibility;
use crate::identity::Id;
use crate::node::Alias;
use crate::rad;
use crate::storage::git::transport;
use crate::storage::git::Storage;
@ -12,10 +14,18 @@ use crate::storage::refs::SignedRefs;
/// The birth of the radicle project, January 1st, 2018.
pub const RADICLE_EPOCH: i64 = 1514817556;
/// Create a new user info object.
pub fn user() -> git::UserInfo {
git::UserInfo {
alias: Alias::new("Radcliff"),
key: PublicKey::from_str("z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi").unwrap(),
}
}
/// Create a new storage with a project.
pub fn storage<P: AsRef<Path>, G: Signer>(path: P, signer: &G) -> Result<Storage, rad::InitError> {
let path = path.as_ref();
let storage = Storage::open(path.join("storage"))?;
let storage = Storage::open(path.join("storage"), user())?;
transport::local::register(storage.clone());
transport::remote::mock::register(signer.public_key(), storage.path());

View File

@ -11,10 +11,13 @@ use crate::node::NodeId;
pub use crate::storage::*;
use super::fixtures;
#[derive(Clone, Debug)]
pub struct MockStorage {
pub path: PathBuf,
pub inventory: HashMap<Id, DocAt>,
pub info: git::UserInfo,
/// All refs keyed by RID.
/// Each value is a map of refs keyed by node Id (public key).
@ -25,17 +28,14 @@ impl MockStorage {
pub fn new(inventory: Vec<(Id, DocAt)>) -> Self {
Self {
path: PathBuf::default(),
info: fixtures::user(),
inventory: inventory.into_iter().collect(),
remotes: HashMap::new(),
}
}
pub fn empty() -> Self {
Self {
path: PathBuf::default(),
inventory: HashMap::new(),
remotes: HashMap::new(),
}
Self::new(Vec::new())
}
/// Add a remote `node` with `signed_refs` for the repo `rid`.
@ -55,6 +55,10 @@ impl MockStorage {
impl ReadStorage for MockStorage {
type Repository = MockRepository;
fn info(&self) -> &git::UserInfo {
&self.info
}
fn path(&self) -> &Path {
self.path.as_path()
}