cob: Remove `description` from `Patch`
Since patches always have a "root" revision, use that revision's description as the patch description.
This commit is contained in:
parent
e18f01cab4
commit
ac60069a33
|
|
@ -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 f4e9dcffb21bee746e0eee965933c7e237aa207a opened
|
||||
✓ Patch 0ec956c94256fa101db4c32956ce195a1aa0edf2 opened
|
||||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||
* [new reference] HEAD -> refs/patches
|
||||
```
|
||||
|
|
@ -12,7 +12,7 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
|
|||
$ git checkout -b feature/2 -q
|
||||
$ git commit --allow-empty -q -m "Second change"
|
||||
$ git push rad HEAD:refs/patches
|
||||
✓ Patch dce2ff0b2baf6da67fae5143b828ebfab65d41e4 opened
|
||||
✓ Patch bf923942537708f7aec4680a321be68cf933e747 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/dce2ff0b2baf6da67fae5143b828ebfab65d41e4
|
||||
rad/patches/f4e9dcffb21bee746e0eee965933c7e237aa207a
|
||||
rad/patches/0ec956c94256fa101db4c32956ce195a1aa0edf2
|
||||
rad/patches/bf923942537708f7aec4680a321be68cf933e747
|
||||
```
|
||||
|
||||
And some remote refs:
|
||||
|
|
@ -35,13 +35,13 @@ $ rad inspect --refs
|
|||
`-- refs
|
||||
|-- cobs
|
||||
| `-- xyz.radicle.patch
|
||||
| |-- dce2ff0b2baf6da67fae5143b828ebfab65d41e4
|
||||
| `-- f4e9dcffb21bee746e0eee965933c7e237aa207a
|
||||
| |-- 0ec956c94256fa101db4c32956ce195a1aa0edf2
|
||||
| `-- bf923942537708f7aec4680a321be68cf933e747
|
||||
|-- heads
|
||||
| |-- master
|
||||
| `-- patches
|
||||
| |-- dce2ff0b2baf6da67fae5143b828ebfab65d41e4
|
||||
| `-- f4e9dcffb21bee746e0eee965933c7e237aa207a
|
||||
| |-- 0ec956c94256fa101db4c32956ce195a1aa0edf2
|
||||
| `-- bf923942537708f7aec4680a321be68cf933e747
|
||||
`-- rad
|
||||
|-- id
|
||||
`-- sigrefs
|
||||
|
|
@ -60,8 +60,8 @@ When we push to `rad/master`, we automatically merge the patches:
|
|||
|
||||
``` (stderr) RAD_SOCKET=/dev/null
|
||||
$ git push rad master
|
||||
✓ Patch dce2ff0b2baf6da67fae5143b828ebfab65d41e4 merged
|
||||
✓ Patch f4e9dcffb21bee746e0eee965933c7e237aa207a merged
|
||||
✓ Patch 0ec956c94256fa101db4c32956ce195a1aa0edf2 merged
|
||||
✓ Patch bf923942537708f7aec4680a321be68cf933e747 merged
|
||||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||
f2de534..e9fff34 master -> master
|
||||
```
|
||||
|
|
@ -70,8 +70,8 @@ $ rad patch --merged
|
|||
╭──────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ ● ID Title Author Head + - Updated │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ✔ dce2ff0 Second change z6MknSL…StBU8Vi (you) e9fff34 +0 -0 [ ... ] │
|
||||
│ ✔ f4e9dcf First change z6MknSL…StBU8Vi (you) 20aa5dd +0 -0 [ ... ] │
|
||||
│ ✔ 0ec956c First change z6MknSL…StBU8Vi (you) 20aa5dd +0 -0 [ ... ] │
|
||||
│ ✔ bf92394 Second change z6MknSL…StBU8Vi (you) e9fff34 +0 -0 [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
|
|
@ -91,8 +91,8 @@ $ rad inspect --refs
|
|||
`-- refs
|
||||
|-- cobs
|
||||
| `-- xyz.radicle.patch
|
||||
| |-- dce2ff0b2baf6da67fae5143b828ebfab65d41e4
|
||||
| `-- f4e9dcffb21bee746e0eee965933c7e237aa207a
|
||||
| |-- 0ec956c94256fa101db4c32956ce195a1aa0edf2
|
||||
| `-- bf923942537708f7aec4680a321be68cf933e747
|
||||
|-- heads
|
||||
| `-- master
|
||||
`-- rad
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@ To open a patch in draft mode, we use the `--draft` option:
|
|||
|
||||
```
|
||||
$ rad patch open --draft -m "Nothing yet" --quiet
|
||||
6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
|
||||
c639a0f9895a0fdf2ba2d04533290937cb6fd2f7
|
||||
```
|
||||
|
||||
We can confirm it's a draft by running `show`:
|
||||
|
||||
```
|
||||
$ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
|
||||
$ rad patch show c639a0f9895a0fdf2ba2d04533290937cb6fd2f7
|
||||
╭────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Nothing yet │
|
||||
│ Patch 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e │
|
||||
│ Patch c639a0f9895a0fdf2ba2d04533290937cb6fd2f7 │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
|
||||
│ Branches cloudhead/draft │
|
||||
|
|
@ -34,14 +34,14 @@ $ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
|
|||
Once the patch is ready for review, we can use the `ready` command:
|
||||
|
||||
```
|
||||
$ rad patch ready 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
|
||||
$ rad patch ready c639a0f9895a0fdf2ba2d04533290937cb6fd2f7
|
||||
```
|
||||
|
||||
```
|
||||
$ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
|
||||
$ rad patch show c639a0f9895a0fdf2ba2d04533290937cb6fd2f7
|
||||
╭────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Nothing yet │
|
||||
│ Patch 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e │
|
||||
│ Patch c639a0f9895a0fdf2ba2d04533290937cb6fd2f7 │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
|
||||
│ Branches cloudhead/draft │
|
||||
|
|
@ -58,11 +58,11 @@ If for whatever reason, it needed to go back into draft mode, we could use
|
|||
the `--undo` flag:
|
||||
|
||||
```
|
||||
$ rad patch ready --undo 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
|
||||
$ rad patch show 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e
|
||||
$ rad patch ready --undo c639a0f9895a0fdf2ba2d04533290937cb6fd2f7
|
||||
$ rad patch show c639a0f9895a0fdf2ba2d04533290937cb6fd2f7
|
||||
╭─────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Nothing yet │
|
||||
│ Patch 6d7793b859860db775fd8ff1d18ffb6de2b9ca0e │
|
||||
│ Patch c639a0f9895a0fdf2ba2d04533290937cb6fd2f7 │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │
|
||||
│ Branches cloudhead/draft │
|
||||
|
|
|
|||
|
|
@ -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 rad HEAD:refs/patches
|
||||
✓ Patch 8f0e8ecb47a17e8f3219f33150a4092d645e4875 opened
|
||||
✓ Patch 37f53b4104edaafcf6beb65e7292147711a06ad0 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 8f0e8ec
|
||||
$ rad patch show 37f53b4
|
||||
╭────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Add things │
|
||||
│ Patch 8f0e8ecb47a17e8f3219f33150a4092d645e4875 │
|
||||
│ Patch 37f53b4104edaafcf6beb65e7292147711a06ad0 │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 42d894a83c9c356552a57af09ccdbd5587a99045 │
|
||||
│ Branches feature/1 │
|
||||
|
|
@ -37,7 +37,7 @@ branch associated with this patch:
|
|||
|
||||
```
|
||||
$ git branch -vv
|
||||
* feature/1 42d894a [rad/patches/8f0e8ecb47a17e8f3219f33150a4092d645e4875] Add things
|
||||
* feature/1 42d894a [rad/patches/37f53b4104edaafcf6beb65e7292147711a06ad0] Add things
|
||||
master f2de534 [rad/master] Second commit
|
||||
```
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ Let's check that it's up to date with our local head:
|
|||
|
||||
```
|
||||
$ git status --short --branch
|
||||
## feature/1...rad/patches/8f0e8ecb47a17e8f3219f33150a4092d645e4875
|
||||
## feature/1...rad/patches/37f53b4104edaafcf6beb65e7292147711a06ad0
|
||||
$ git fetch
|
||||
$ git push
|
||||
```
|
||||
|
|
@ -57,13 +57,13 @@ $ git show-ref
|
|||
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/feature/1
|
||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master
|
||||
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/remotes/rad/master
|
||||
42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/8f0e8ecb47a17e8f3219f33150a4092d645e4875
|
||||
42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/37f53b4104edaafcf6beb65e7292147711a06ad0
|
||||
```
|
||||
```
|
||||
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 'refs/heads/patches/*'
|
||||
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/patches/8f0e8ecb47a17e8f3219f33150a4092d645e4875
|
||||
42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/patches/37f53b4104edaafcf6beb65e7292147711a06ad0
|
||||
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 'refs/cobs/*'
|
||||
8f0e8ecb47a17e8f3219f33150a4092d645e4875 refs/cobs/xyz.radicle.patch/8f0e8ecb47a17e8f3219f33150a4092d645e4875
|
||||
37f53b4104edaafcf6beb65e7292147711a06ad0 refs/cobs/xyz.radicle.patch/37f53b4104edaafcf6beb65e7292147711a06ad0
|
||||
```
|
||||
|
||||
We can also create patches by pushing to the `rad/patches` remote. It's a bit
|
||||
|
|
@ -73,7 +73,7 @@ simpler:
|
|||
$ git checkout -b feature/2 -q
|
||||
$ git commit -a -m "Add more things" -q --allow-empty
|
||||
$ git push rad/patches
|
||||
✓ Patch 8678aafff1d1e28430952abf431e60b87e28023c opened
|
||||
✓ Patch 2af090f48003d86f735163794bfffdb2691f369e opened
|
||||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||
* [new reference] HEAD -> refs/patches
|
||||
```
|
||||
|
|
@ -82,8 +82,8 @@ We see both branches with upstreams now:
|
|||
|
||||
```
|
||||
$ git branch -vv
|
||||
feature/1 42d894a [rad/patches/8f0e8ecb47a17e8f3219f33150a4092d645e4875] Add things
|
||||
* feature/2 b94a835 [rad/patches/8678aafff1d1e28430952abf431e60b87e28023c] Add more things
|
||||
feature/1 42d894a [rad/patches/37f53b4104edaafcf6beb65e7292147711a06ad0] Add things
|
||||
* feature/2 b94a835 [rad/patches/2af090f48003d86f735163794bfffdb2691f369e] Add more things
|
||||
master f2de534 [rad/master] Second commit
|
||||
```
|
||||
|
||||
|
|
@ -94,8 +94,8 @@ $ rad patch
|
|||
╭────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ ● ID Title Author Head + - Updated │
|
||||
├────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● 8678aaf Add more things z6MknSL…StBU8Vi (you) b94a835 +0 -0 [ ... ] │
|
||||
│ ● 8f0e8ec Add things z6MknSL…StBU8Vi (you) 42d894a +0 -0 [ ... ] │
|
||||
│ ● 2af090f Add more things z6MknSL…StBU8Vi (you) b94a835 +0 -0 [ ... ] │
|
||||
│ ● 37f53b4 Add things z6MknSL…StBU8Vi (you) 42d894a +0 -0 [ ... ] │
|
||||
╰────────────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
|
|
@ -114,9 +114,9 @@ $ git commit -a -m "Improve code" -q --allow-empty
|
|||
|
||||
``` (stderr)
|
||||
$ git push
|
||||
✓ Patch 8678aaf updated to 4b6618a6ccb0b406659364a70a00bb60e4cd7cf0
|
||||
✓ Patch 2af090f updated to f532e40e44de298b27d2255acb50b99bf0377a04
|
||||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||
b94a835..662843e feature/2 -> patches/8678aafff1d1e28430952abf431e60b87e28023c
|
||||
b94a835..662843e feature/2 -> patches/2af090f48003d86f735163794bfffdb2691f369e
|
||||
```
|
||||
|
||||
This last `git push` worked without specifying an upstream branch despite the
|
||||
|
|
@ -134,10 +134,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 8678aaf
|
||||
$ rad patch show 2af090f
|
||||
╭──────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Add more things │
|
||||
│ Patch 8678aafff1d1e28430952abf431e60b87e28023c │
|
||||
│ Patch 2af090f48003d86f735163794bfffdb2691f369e │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 662843ed81e76efa69d7901fb7bdd775043015d0 │
|
||||
│ Branches feature/2 │
|
||||
|
|
@ -149,7 +149,7 @@ $ rad patch show 8678aaf
|
|||
│ 42d894a Add things │
|
||||
├──────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● opened by (you) (z6MknSL…StBU8Vi) [ ... ] │
|
||||
│ ↑ updated to 4b6618a6ccb0b406659364a70a00bb60e4cd7cf0 (662843e) [ ... ] │
|
||||
│ ↑ updated to f532e40e44de298b27d2255acb50b99bf0377a04 (662843e) [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
|
|
@ -162,14 +162,14 @@ $ git rev-parse HEAD
|
|||
|
||||
```
|
||||
$ git status --short --branch
|
||||
## feature/2...rad/patches/8678aafff1d1e28430952abf431e60b87e28023c
|
||||
## feature/2...rad/patches/2af090f48003d86f735163794bfffdb2691f369e
|
||||
```
|
||||
|
||||
```
|
||||
$ git rev-parse refs/remotes/rad/patches/8678aafff1d1e28430952abf431e60b87e28023c
|
||||
$ git rev-parse refs/remotes/rad/patches/2af090f48003d86f735163794bfffdb2691f369e
|
||||
662843ed81e76efa69d7901fb7bdd775043015d0
|
||||
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi refs/heads/patches/8678aafff1d1e28430952abf431e60b87e28023c
|
||||
662843ed81e76efa69d7901fb7bdd775043015d0 refs/heads/patches/8678aafff1d1e28430952abf431e60b87e28023c
|
||||
$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi refs/heads/patches/2af090f48003d86f735163794bfffdb2691f369e
|
||||
662843ed81e76efa69d7901fb7bdd775043015d0 refs/heads/patches/2af090f48003d86f735163794bfffdb2691f369e
|
||||
```
|
||||
|
||||
## Force push
|
||||
|
|
@ -190,7 +190,7 @@ Now let's push to the patch head.
|
|||
``` (stderr) (fail)
|
||||
$ git push
|
||||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||
! [rejected] feature/2 -> patches/8678aafff1d1e28430952abf431e60b87e28023c (non-fast-forward)
|
||||
! [rejected] feature/2 -> patches/2af090f48003d86f735163794bfffdb2691f369e (non-fast-forward)
|
||||
error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi'
|
||||
hint: Updates were rejected because a pushed branch tip is behind its remote
|
||||
hint: counterpart. Check out this branch and integrate the remote changes
|
||||
|
|
@ -203,18 +203,18 @@ use `--force` to force the update.
|
|||
|
||||
``` (stderr)
|
||||
$ git push --force
|
||||
✓ Patch 8678aaf updated to 983f2d21c9fbe91c21ddfbcd3e3d6cd13db0a944
|
||||
✓ Patch 2af090f updated to d7590abe04594263eeb88cc0e28502139ec8414f
|
||||
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||
+ 662843e...3507cd5 feature/2 -> patches/8678aafff1d1e28430952abf431e60b87e28023c (forced update)
|
||||
+ 662843e...3507cd5 feature/2 -> patches/2af090f48003d86f735163794bfffdb2691f369e (forced update)
|
||||
```
|
||||
|
||||
That worked. We can see the new revision if we call `rad patch show`:
|
||||
|
||||
```
|
||||
$ rad patch show 8678aaf
|
||||
$ rad patch show 2af090f
|
||||
╭──────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Add more things │
|
||||
│ Patch 8678aafff1d1e28430952abf431e60b87e28023c │
|
||||
│ Patch 2af090f48003d86f735163794bfffdb2691f369e │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 3507cd57811fe5f21f6a0a610a1ac8068b3a5d9f │
|
||||
│ Branches feature/2 │
|
||||
|
|
@ -226,7 +226,7 @@ $ rad patch show 8678aaf
|
|||
│ 42d894a Add things │
|
||||
├──────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● opened by (you) (z6MknSL…StBU8Vi) [ ... ] │
|
||||
│ ↑ updated to 4b6618a6ccb0b406659364a70a00bb60e4cd7cf0 (662843e) [ ... ] │
|
||||
│ ↑ updated to 983f2d21c9fbe91c21ddfbcd3e3d6cd13db0a944 (3507cd5) [ ... ] │
|
||||
│ ↑ updated to f532e40e44de298b27d2255acb50b99bf0377a04 (662843e) [ ... ] │
|
||||
│ ↑ updated to d7590abe04594263eeb88cc0e28502139ec8414f (3507cd5) [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ master <- z6MknSL…StBU8Vi/flux-capacitor-power (3e674d1)
|
|||
|
||||
3e674d1 Define power requirements
|
||||
|
||||
✓ Patch de3096d5cc422136016ac210b870bfa9d0f11481 created
|
||||
✓ Patch 077e4bbe9a6e5546f400ef5951768c37a76f13a4 created
|
||||
|
||||
To publish your patch to the network, run:
|
||||
git push rad
|
||||
|
|
@ -44,14 +44,14 @@ $ rad patch
|
|||
╭──────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ ● ID Title Author Head + - Updated │
|
||||
├──────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● de3096d Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 [ ... ] │
|
||||
│ ● 077e4bb Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
```
|
||||
$ rad patch show de3096d5cc422136016ac210b870bfa9d0f11481 -p
|
||||
$ rad patch show 077e4bbe9a6e5546f400ef5951768c37a76f13a4 -p
|
||||
╭────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Define power requirements │
|
||||
│ Patch de3096d5cc422136016ac210b870bfa9d0f11481 │
|
||||
│ Patch 077e4bbe9a6e5546f400ef5951768c37a76f13a4 │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
|
||||
│ Branches flux-capacitor-power │
|
||||
|
|
@ -93,45 +93,45 @@ $ git commit --message "Add README, just for the fun"
|
|||
[flux-capacitor-power 27857ec] Add README, just for the fun
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
create mode 100644 README.md
|
||||
$ rad patch update --message "Add README, just for the fun" de3096d5cc422136016ac210b870bfa9d0f11481
|
||||
$ rad patch update --message "Add README, just for the fun" 077e4bbe9a6e5546f400ef5951768c37a76f13a4
|
||||
Updating 3e674d1 -> 27857ec
|
||||
1 commit(s) ahead, 0 commit(s) behind
|
||||
✓ Patch updated to revision d00f978a43a255c7f2f9f23d39b555d103900c6d
|
||||
✓ Patch updated to revision 5cdcd2e14411e2bfec7b11bcf4667e2e0fc4d417
|
||||
```
|
||||
|
||||
And let's leave a quick comment for our team:
|
||||
|
||||
```
|
||||
$ rad comment de3096d5cc422136016ac210b870bfa9d0f11481 --message 'I cannot wait to get back to the 90s!'
|
||||
225353d1b9195f6cf4cfe098ce7935d4c933c36e
|
||||
$ rad comment de3096d5cc422136016ac210b870bfa9d0f11481 --message 'I cannot wait to get back to the 90s!' --reply-to 225353d1b9195f6cf4cfe098ce7935d4c933c36e
|
||||
089c2d74d18036c75b1b4d3a32770c720a6967e2
|
||||
$ rad comment 077e4bbe9a6e5546f400ef5951768c37a76f13a4 --message 'I cannot wait to get back to the 90s!'
|
||||
31a07b8e7758af2027e74e521a74bea4574280e7
|
||||
$ rad comment 077e4bbe9a6e5546f400ef5951768c37a76f13a4 --message 'I cannot wait to get back to the 90s!' --reply-to 31a07b8e7758af2027e74e521a74bea4574280e7
|
||||
d66bcb6bfe2e06e57636e8b1ba3ef8098a8bb250
|
||||
```
|
||||
|
||||
Now, let's checkout the patch that we just created:
|
||||
|
||||
```
|
||||
$ rad patch checkout de3096d
|
||||
✓ Switched to branch patch/de3096d
|
||||
$ rad patch checkout 077e4bb
|
||||
✓ Switched to branch patch/077e4bb
|
||||
```
|
||||
|
||||
We can also add a review verdict as such:
|
||||
|
||||
```
|
||||
$ rad review de3096d5cc422136016ac210b870bfa9d0f11481 --accept --no-message --no-sync
|
||||
✓ Patch de3096d accepted
|
||||
$ rad review 077e4bbe9a6e5546f400ef5951768c37a76f13a4 --accept --no-message --no-sync
|
||||
✓ Patch 077e4bb accepted
|
||||
```
|
||||
|
||||
Showing the patch list now will reveal the favorable verdict:
|
||||
|
||||
```
|
||||
$ rad patch show de3096d
|
||||
$ rad patch show 077e4bb
|
||||
╭──────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Define power requirements │
|
||||
│ Patch de3096d5cc422136016ac210b870bfa9d0f11481 │
|
||||
│ Patch 077e4bbe9a6e5546f400ef5951768c37a76f13a4 │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Branches flux-capacitor-power, patch/de3096d │
|
||||
│ Branches flux-capacitor-power, patch/077e4bb │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
│ │
|
||||
|
|
@ -141,7 +141,7 @@ $ rad patch show de3096d
|
|||
│ 3e674d1 Define power requirements │
|
||||
├──────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● opened by (you) (z6MknSL…StBU8Vi) [ ... ] │
|
||||
│ ↑ updated to d00f978a43a255c7f2f9f23d39b555d103900c6d (27857ec) [ ... ] │
|
||||
│ ↑ updated to 5cdcd2e14411e2bfec7b11bcf4667e2e0fc4d417 (27857ec) [ ... ] │
|
||||
│ ✓ accepted by (you) (z6MknSL…StBU8Vi) [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
|
@ -149,14 +149,14 @@ $ rad patch show de3096d
|
|||
If you make a mistake on the patch description, you can always change it!
|
||||
|
||||
```
|
||||
$ rad patch edit de3096d --message "Define power requirements" --message "Add requirements file"
|
||||
$ rad patch show de3096d
|
||||
$ rad patch edit 077e4bb --message "Define power requirements" --message "Add requirements file"
|
||||
$ rad patch show 077e4bb
|
||||
╭──────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Define power requirements │
|
||||
│ Patch de3096d5cc422136016ac210b870bfa9d0f11481 │
|
||||
│ Patch 077e4bbe9a6e5546f400ef5951768c37a76f13a4 │
|
||||
│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Branches flux-capacitor-power, patch/de3096d │
|
||||
│ Branches flux-capacitor-power, patch/077e4bb │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
│ Status open │
|
||||
│ │
|
||||
|
|
@ -166,7 +166,7 @@ $ rad patch show de3096d
|
|||
│ 3e674d1 Define power requirements │
|
||||
├──────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● opened by (you) (z6MknSL…StBU8Vi) [ ... ] │
|
||||
│ ↑ updated to d00f978a43a255c7f2f9f23d39b555d103900c6d (27857ec) [ ... ] │
|
||||
│ ↑ updated to 5cdcd2e14411e2bfec7b11bcf4667e2e0fc4d417 (27857ec) [ ... ] │
|
||||
│ ✓ accepted by (you) (z6MknSL…StBU8Vi) [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ master <- z6Mkt67…v4N1tRk/flux-capacitor-power (3e674d1)
|
|||
|
||||
3e674d1 Define power requirements
|
||||
|
||||
✓ Patch 5f0a547f7a91bf002bb0542035a647fd5af134a5 created
|
||||
✓ Patch 50e29a111972f3b7d2123c5057de5bdf09bc7b1c created
|
||||
|
||||
To publish your patch to the network, run:
|
||||
git push rad
|
||||
|
|
@ -44,12 +44,12 @@ $ rad patch
|
|||
╭──────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ ● ID Title Author Head + - Updated │
|
||||
├──────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● 5f0a547 Define power requirements z6Mkt67…v4N1tRk (you) 3e674d1 +0 -0 [ ... ] │
|
||||
│ ● 50e29a1 Define power requirements z6Mkt67…v4N1tRk (you) 3e674d1 +0 -0 [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
$ rad patch show 5f0a547f7a91bf002bb0542035a647fd5af134a5
|
||||
$ rad patch show 50e29a111972f3b7d2123c5057de5bdf09bc7b1c
|
||||
╭────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Define power requirements │
|
||||
│ Patch 5f0a547f7a91bf002bb0542035a647fd5af134a5 │
|
||||
│ Patch 50e29a111972f3b7d2123c5057de5bdf09bc7b1c │
|
||||
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │
|
||||
│ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │
|
||||
│ Branches flux-capacitor-power │
|
||||
|
|
@ -80,15 +80,15 @@ $ git commit --message "Add README, just for the fun"
|
|||
[flux-capacitor-power 27857ec] Add README, just for the fun
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
create mode 100644 README.md
|
||||
$ rad patch update --message "Add README, just for the fun" 5f0a547f7a91bf002bb0542035a647fd5af134a5
|
||||
$ rad patch update --message "Add README, just for the fun" 50e29a111972f3b7d2123c5057de5bdf09bc7b1c
|
||||
Updating 3e674d1 -> 27857ec
|
||||
1 commit(s) ahead, 0 commit(s) behind
|
||||
✓ Patch updated to revision b7e2356fb7e3981980b42603eea969851d17a40d
|
||||
✓ Patch updated to revision 3530243d46a2e7a8e4eac7afcbb17cc7c56b3d29
|
||||
```
|
||||
|
||||
And let's leave a quick comment for our team:
|
||||
|
||||
```
|
||||
$ rad comment 5f0a547f7a91bf002bb0542035a647fd5af134a5 --message 'I cannot wait to get back to the 90s!'
|
||||
a15e976e4273971d6695eff2e07a57a82133567f
|
||||
$ rad comment 50e29a111972f3b7d2123c5057de5bdf09bc7b1c --message 'I cannot wait to get back to the 90s!'
|
||||
4a9d780cf088769722d226d83a1b4663ab176f8e
|
||||
```
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ $ git branch -r
|
|||
bob/flux-capacitor-power
|
||||
bob/master
|
||||
rad/master
|
||||
$ rad patch show 5f0a547
|
||||
$ rad patch show 50e29a1
|
||||
╭──────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Define power requirements │
|
||||
│ Patch 5f0a547f7a91bf002bb0542035a647fd5af134a5 │
|
||||
│ Patch 50e29a111972f3b7d2123c5057de5bdf09bc7b1c │
|
||||
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │
|
||||
│ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │
|
||||
│ Commits ahead 2, behind 0 │
|
||||
|
|
@ -47,7 +47,7 @@ $ rad patch show 5f0a547
|
|||
│ 3e674d1 Define power requirements │
|
||||
├──────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● opened by bob (z6Mkt67…v4N1tRk) [ ... ] │
|
||||
│ ↑ updated to b7e2356fb7e3981980b42603eea969851d17a40d (27857ec) [ ... ] │
|
||||
│ ↑ updated to 3530243d46a2e7a8e4eac7afcbb17cc7c56b3d29 (27857ec) [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
|
|
@ -64,10 +64,10 @@ $ git commit --fixup HEAD~
|
|||
[flux-capacitor-power f6484e0] fixup! Define power requirements
|
||||
1 file changed, 0 insertions(+), 0 deletions(-)
|
||||
rename REQUIREMENTS => REQUIREMENTS.md (100%)
|
||||
$ rad patch update --message "Define power requirements" --message "See details." 5f0a547f7a91bf002bb0542035a647fd5af134a5
|
||||
$ rad patch update --message "Define power requirements" --message "See details." 50e29a111972f3b7d2123c5057de5bdf09bc7b1c
|
||||
Updating 27857ec -> f6484e0
|
||||
1 commit(s) ahead, 0 commit(s) behind
|
||||
✓ Patch updated to revision 4486280d0dec743d6a1a0c05754f8e40426c681d
|
||||
✓ Patch updated to revision a3405e8e174d9660fead6eea1dea5cdd2b728488
|
||||
```
|
||||
|
||||
Great, all fixed up, lets merge the code.
|
||||
|
|
@ -89,10 +89,10 @@ $ git push rad master
|
|||
The patch is now merged and closed :).
|
||||
|
||||
```
|
||||
$ rad patch show 5f0a547
|
||||
$ rad patch show 50e29a1
|
||||
╭──────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Title Define power requirements │
|
||||
│ Patch 5f0a547f7a91bf002bb0542035a647fd5af134a5 │
|
||||
│ Patch 50e29a111972f3b7d2123c5057de5bdf09bc7b1c │
|
||||
│ Author did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │
|
||||
│ Head f6484e0f43e48a8983b9b39bf9bd4cd889f1d520 │
|
||||
│ Branches flux-capacitor-power, master │
|
||||
|
|
@ -106,8 +106,8 @@ $ rad patch show 5f0a547
|
|||
│ 3e674d1 Define power requirements │
|
||||
├──────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● opened by bob (z6Mkt67…v4N1tRk) [ ... ] │
|
||||
│ ↑ updated to b7e2356fb7e3981980b42603eea969851d17a40d (27857ec) [ ... ] │
|
||||
│ ↑ updated to 4486280d0dec743d6a1a0c05754f8e40426c681d (f6484e0) [ ... ] │
|
||||
│ ↑ updated to 3530243d46a2e7a8e4eac7afcbb17cc7c56b3d29 (27857ec) [ ... ] │
|
||||
│ ↑ updated to a3405e8e174d9660fead6eea1dea5cdd2b728488 (f6484e0) [ ... ] │
|
||||
│ ✓ merged by (you) (z6MknSL…StBU8Vi) [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
|
|
|||
|
|
@ -21,11 +21,34 @@ pub fn run(
|
|||
let default_msg = term::patch::message(patch.title(), patch.description());
|
||||
let (title, description) = term::patch::get_message(message, &default_msg)?;
|
||||
|
||||
if title == patch.title() && description == patch.description() {
|
||||
// Nothing to do
|
||||
let title = if title != patch.title() {
|
||||
Some(title)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let description = if description != patch.description() {
|
||||
Some(description)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
if title.is_none() && description.is_none() {
|
||||
// Nothing to do.
|
||||
return Ok(());
|
||||
}
|
||||
patch.edit(title, description, patch.target(), &signer)?;
|
||||
|
||||
let root = patch.id.into();
|
||||
let target = patch.target();
|
||||
|
||||
patch.transaction("Edit", &signer, |tx| {
|
||||
if let Some(t) = title {
|
||||
tx.edit(t, target)?;
|
||||
}
|
||||
if let Some(d) = description {
|
||||
tx.edit_revision(root, d)?;
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ use nonempty::NonEmpty;
|
|||
use radicle_crypto::PublicKey;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::object;
|
||||
use crate::pruning_fold;
|
||||
use crate::{object, ObjectId};
|
||||
|
||||
/// Entry contents.
|
||||
/// This is the change payload.
|
||||
|
|
@ -66,6 +66,12 @@ impl From<&EntryId> for object::ObjectId {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<ObjectId> for EntryId {
|
||||
fn from(id: ObjectId) -> Self {
|
||||
Self(*id)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for EntryId {
|
||||
type Target = Oid;
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ pub(crate) fn patch(
|
|||
"id": id.to_string(),
|
||||
"author": author(patch.author(), aliases.alias(patch.author().id())),
|
||||
"title": patch.title(),
|
||||
"description": patch.description(),
|
||||
"state": patch.state(),
|
||||
"target": patch.target(),
|
||||
"tags": patch.tags().collect::<Vec<_>>(),
|
||||
|
|
|
|||
|
|
@ -648,12 +648,8 @@ async fn patch_update_handler(
|
|||
let mut patches = patch::Patches::open(&repo)?;
|
||||
let mut patch = patches.get_mut(&patch_id.into())?;
|
||||
match action {
|
||||
patch::Action::Edit {
|
||||
title,
|
||||
description,
|
||||
target,
|
||||
} => {
|
||||
patch.edit(title, description, target, &signer)?;
|
||||
patch::Action::Edit { title, target } => {
|
||||
patch.edit(title, target, &signer)?;
|
||||
}
|
||||
patch::Action::EditRevision {
|
||||
revision,
|
||||
|
|
@ -1741,7 +1737,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID
|
||||
},
|
||||
"title": "A new `hello world`",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"state": { "status": "open" },
|
||||
"target": "delegates",
|
||||
"tags": [],
|
||||
|
|
@ -1749,7 +1744,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CONTRIBUTOR_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
@ -1780,7 +1775,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID
|
||||
},
|
||||
"title": "A new `hello world`",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"state": { "status": "open" },
|
||||
"target": "delegates",
|
||||
"tags": [],
|
||||
|
|
@ -1788,7 +1782,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CONTRIBUTOR_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
@ -1806,7 +1800,7 @@ mod routes {
|
|||
|
||||
#[tokio::test]
|
||||
async fn test_projects_create_patches() {
|
||||
const CREATED_PATCH_ID: &str = "198b7bc8d19ef2f09e9fbd30645a46e4cd520713";
|
||||
const CREATED_PATCH_ID: &str = "768e76ae6611d9392f04122a5aa7a587b47b9e19";
|
||||
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let ctx = contributor(tmp.path());
|
||||
|
|
@ -1858,7 +1852,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID
|
||||
},
|
||||
"title": "Update README",
|
||||
"description": "Do some changes to README",
|
||||
"state": { "status": "open" },
|
||||
"target": "delegates",
|
||||
"tags": [],
|
||||
|
|
@ -1866,7 +1859,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CREATED_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "Do some changes to README",
|
||||
"base": INITIAL_COMMIT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
@ -1918,7 +1911,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID,
|
||||
},
|
||||
"title": "A new `hello world`",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"state": { "status": "open" },
|
||||
"target": "delegates",
|
||||
"tags": [
|
||||
|
|
@ -1929,7 +1921,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CONTRIBUTOR_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
@ -1981,7 +1973,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID,
|
||||
},
|
||||
"title": "A new `hello world`",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"state": { "status": "open" },
|
||||
"target": "delegates",
|
||||
"tags": [],
|
||||
|
|
@ -1989,7 +1980,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CONTRIBUTOR_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
@ -2000,7 +1991,7 @@ mod routes {
|
|||
"reviews": [],
|
||||
},
|
||||
{
|
||||
"id": "660ce23a54788d85d44a133357b53fc99f5d7a92",
|
||||
"id": "181e4219bc132e7716126a84200d4dbd628dd6be",
|
||||
"description": "This is a new revision",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
|
|
@ -2053,7 +2044,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID,
|
||||
},
|
||||
"title": "This is a updated title",
|
||||
"description": "Let's write some description",
|
||||
"state": { "status": "open" },
|
||||
"target": "delegates",
|
||||
"tags": [],
|
||||
|
|
@ -2061,7 +2051,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CONTRIBUTOR_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
@ -2135,7 +2125,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID,
|
||||
},
|
||||
"title": "A new `hello world`",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"state": { "status": "open" },
|
||||
"target": "delegates",
|
||||
"tags": [],
|
||||
|
|
@ -2143,7 +2132,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CONTRIBUTOR_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
@ -2231,7 +2220,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID,
|
||||
},
|
||||
"title": "A new `hello world`",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"state": { "status": "open" },
|
||||
"target": "delegates",
|
||||
"tags": [],
|
||||
|
|
@ -2239,7 +2227,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CONTRIBUTOR_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
@ -2314,7 +2302,6 @@ mod routes {
|
|||
"id": CONTRIBUTOR_DID,
|
||||
},
|
||||
"title": "A new `hello world`",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"state": {
|
||||
"status": "merged",
|
||||
"revision": CONTRIBUTOR_PATCH_ID,
|
||||
|
|
@ -2331,7 +2318,7 @@ mod routes {
|
|||
"revisions": [
|
||||
{
|
||||
"id": CONTRIBUTOR_PATCH_ID,
|
||||
"description": "",
|
||||
"description": "change `hello world` in README to something else",
|
||||
"base": PARENT,
|
||||
"oid": HEAD,
|
||||
"refs": [
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ 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 = "f1dff128a22e8183a23516dd9812e72e80914c92";
|
||||
pub const CONTRIBUTOR_PATCH_ID: &str = "dcac7b6a320ce94e9a801ff9d766a04d24f63062";
|
||||
pub const CONTRIBUTOR_COMMENT_1: &str = "ec1c721cb3f726c3c0455519034c3a8b1a6ebaef";
|
||||
pub const CONTRIBUTOR_COMMENT_2: &str = "4458381a73ff68063311d440538aff4b48122b9c";
|
||||
pub const CONTRIBUTOR_PATCH_ID: &str = "044b577cc7551cd09d4b2f03566a553762180de4";
|
||||
pub const CONTRIBUTOR_COMMENT_1: &str = "92aab76516ae7f60a9b2952043ba578383de7d46";
|
||||
pub const CONTRIBUTOR_COMMENT_2: &str = "cb360eee0ec70563d5c4c3613fdc076648523248";
|
||||
|
||||
const PASSWORD: &str = "radicle";
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ pub enum Error {
|
|||
pub enum Action {
|
||||
Edit {
|
||||
title: String,
|
||||
description: String,
|
||||
target: MergeTarget,
|
||||
},
|
||||
EditRevision {
|
||||
|
|
@ -160,8 +159,6 @@ pub enum MergeTarget {
|
|||
pub struct Patch {
|
||||
/// Title of the patch.
|
||||
title: LWWReg<Max<String>>,
|
||||
/// Patch description.
|
||||
description: LWWReg<Max<String>>,
|
||||
/// Current state of the patch.
|
||||
state: LWWReg<Max<State>>,
|
||||
/// Target this patch is meant to be merged in.
|
||||
|
|
@ -180,7 +177,6 @@ pub struct Patch {
|
|||
impl Semilattice for Patch {
|
||||
fn merge(&mut self, other: Self) {
|
||||
self.title.merge(other.title);
|
||||
self.description.merge(other.description);
|
||||
self.state.merge(other.state);
|
||||
self.target.merge(other.target);
|
||||
self.merges.merge(other.merges);
|
||||
|
|
@ -194,7 +190,6 @@ impl Default for Patch {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
title: LWWReg::initial(Max::from(String::default())),
|
||||
description: LWWReg::initial(Max::from(String::default())),
|
||||
state: LWWReg::initial(Max::from(State::default())),
|
||||
target: LWWReg::initial(Max::from(MergeTarget::default())),
|
||||
tags: LWWSet::default(),
|
||||
|
|
@ -237,7 +232,7 @@ impl Patch {
|
|||
|
||||
/// Patch description.
|
||||
pub fn description(&self) -> &str {
|
||||
self.description.get().get()
|
||||
self.root().description()
|
||||
}
|
||||
|
||||
/// Author of the first revision of the patch.
|
||||
|
|
@ -302,6 +297,16 @@ impl Patch {
|
|||
.expect("Patch::version: at least one revision is present")
|
||||
}
|
||||
|
||||
/// Root revision.
|
||||
///
|
||||
/// This is the revision that was created with the patch.
|
||||
pub fn root(&self) -> &Revision {
|
||||
self.revisions()
|
||||
.next()
|
||||
.map(|(_, r)| r)
|
||||
.expect("Patch::root: there is always a root revision")
|
||||
}
|
||||
|
||||
/// Latest revision.
|
||||
pub fn latest(&self) -> Option<(&RevisionId, &Revision)> {
|
||||
self.revisions().next_back()
|
||||
|
|
@ -344,13 +349,8 @@ impl store::FromHistory for Patch {
|
|||
self.timeline.insert((op.clock, id));
|
||||
|
||||
match op.action {
|
||||
Action::Edit {
|
||||
title,
|
||||
description,
|
||||
target,
|
||||
} => {
|
||||
Action::Edit { title, target } => {
|
||||
self.title.set(title, op.clock);
|
||||
self.description.set(description, op.clock);
|
||||
self.target.set(target, op.clock);
|
||||
}
|
||||
Action::Lifecycle { state } => {
|
||||
|
|
@ -829,15 +829,9 @@ impl Review {
|
|||
}
|
||||
|
||||
impl store::Transaction<Patch> {
|
||||
pub fn edit(
|
||||
&mut self,
|
||||
title: impl ToString,
|
||||
description: impl ToString,
|
||||
target: MergeTarget,
|
||||
) -> Result<(), store::Error> {
|
||||
pub fn edit(&mut self, title: impl ToString, target: MergeTarget) -> Result<(), store::Error> {
|
||||
self.push(Action::Edit {
|
||||
title: title.to_string(),
|
||||
description: description.to_string(),
|
||||
target,
|
||||
})
|
||||
}
|
||||
|
|
@ -989,11 +983,10 @@ impl<'a, 'g> PatchMut<'a, 'g> {
|
|||
pub fn edit<G: Signer>(
|
||||
&mut self,
|
||||
title: String,
|
||||
description: String,
|
||||
target: MergeTarget,
|
||||
signer: &G,
|
||||
) -> Result<EntryId, Error> {
|
||||
self.transaction("Edit", signer, |tx| tx.edit(title, description, target))
|
||||
self.transaction("Edit", signer, |tx| tx.edit(title, target))
|
||||
}
|
||||
|
||||
/// Edit revision metadata.
|
||||
|
|
@ -1285,8 +1278,8 @@ impl<'a> Patches<'a> {
|
|||
) -> Result<PatchMut<'a, 'g>, Error> {
|
||||
let (id, patch, clock) =
|
||||
Transaction::initial("Create patch", &mut self.raw, signer, |tx| {
|
||||
tx.revision(String::default(), base, oid)?;
|
||||
tx.edit(title, description, target)?;
|
||||
tx.revision(description, base, oid)?;
|
||||
tx.edit(title, target)?;
|
||||
tx.tag(tags.to_owned(), [])?;
|
||||
|
||||
if state != State::default() {
|
||||
|
|
@ -1367,7 +1360,6 @@ mod test {
|
|||
clock.tick(),
|
||||
actor.op(Action::Edit {
|
||||
title: iter::repeat_with(|| rng.alphabetic()).take(8).collect(),
|
||||
description: iter::repeat_with(|| rng.alphabetic()).take(16).collect(),
|
||||
target: MergeTarget::Delegates,
|
||||
}),
|
||||
))
|
||||
|
|
@ -1518,7 +1510,7 @@ mod test {
|
|||
let (rev_id, revision) = patch.latest().unwrap();
|
||||
|
||||
assert_eq!(revision.author.id(), &author);
|
||||
assert_eq!(revision.description(), "");
|
||||
assert_eq!(revision.description(), "Blah blah blah.");
|
||||
assert_eq!(revision.discussion.len(), 0);
|
||||
assert_eq!(revision.oid, pr.oid);
|
||||
assert_eq!(revision.base, pr.base);
|
||||
|
|
@ -1978,7 +1970,10 @@ mod test {
|
|||
assert_eq!(patch.version(), 1);
|
||||
assert_eq!(patch.revisions.len(), 2);
|
||||
assert_eq!(patch.revisions().count(), 2);
|
||||
assert_eq!(patch.revisions().nth(0).unwrap().1.description(), "");
|
||||
assert_eq!(
|
||||
patch.revisions().nth(0).unwrap().1.description(),
|
||||
"Blah blah blah."
|
||||
);
|
||||
assert_eq!(
|
||||
patch.revisions().nth(1).unwrap().1.description(),
|
||||
"I've made changes."
|
||||
|
|
|
|||
|
|
@ -202,7 +202,6 @@ impl<G: Signer> Actor<G, super::patch::Action> {
|
|||
}),
|
||||
self.op(patch::Action::Edit {
|
||||
title: title.to_string(),
|
||||
description: description.to_string(),
|
||||
target: patch::MergeTarget::default(),
|
||||
}),
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue