From a46bcb224708402e9a3042a126a8154f965dc71e Mon Sep 17 00:00:00 2001 From: cloudhead Date: Thu, 18 Jan 2024 11:28:22 +0100 Subject: [PATCH] cob: Distinguish between commit parents Previously, COB change commits would not distinguish between their parents. This means that they would try to load source code commits (eg. for patch COBs) and then fail since those commits wouldn't have a manifest or `Rad-Resource`. We introduce a backwards compatible change here which is that parent oids that are not COB commits are accompanied by a commit trailer called `Rad-Related`. This is for all related content that should be pulled in but is not part of the change graph proper. When building the change graph, we simply ignore commits that are marked as "related". --- radicle-cli/examples/rad-cob.md | 71 +++++++++++++++---- radicle-cli/examples/rad-id.md | 14 ++-- .../examples/rad-merge-after-update.md | 8 +-- radicle-cli/examples/rad-merge-no-ff.md | 4 +- radicle-cli/examples/rad-merge-via-push.md | 30 ++++---- .../examples/rad-patch-ahead-behind.md | 20 +++--- radicle-cli/examples/rad-patch-change-base.md | 18 ++--- .../examples/rad-patch-checkout-force.md | 20 +++--- .../examples/rad-patch-checkout-revision.md | 16 ++--- radicle-cli/examples/rad-patch-checkout.md | 18 ++--- radicle-cli/examples/rad-patch-diff.md | 6 +- radicle-cli/examples/rad-patch-draft.md | 18 ++--- radicle-cli/examples/rad-patch-edit.md | 28 ++++---- radicle-cli/examples/rad-patch-fetch-2.md | 4 +- radicle-cli/examples/rad-patch-merge-draft.md | 4 +- .../examples/rad-patch-open-explore.md | 12 ++-- radicle-cli/examples/rad-patch-pull-update.md | 24 +++---- radicle-cli/examples/rad-patch-update.md | 16 ++--- radicle-cli/examples/rad-patch-via-push.md | 60 ++++++++-------- radicle-cli/examples/rad-patch.md | 60 ++++++++-------- .../examples/rad-push-and-pull-patches.md | 24 +++---- radicle-cli/examples/rad-review-by-hunk.md | 28 ++++---- .../workflow/4-patching-contributor.md | 18 ++--- .../workflow/5-patching-maintainer.md | 38 +++++----- radicle-cli/src/commands/cob.rs | 13 ++-- radicle-cob/src/backend/git/change.rs | 55 +++++++++----- radicle-cob/src/change/store.rs | 6 +- radicle-cob/src/change_graph.rs | 26 +++---- .../src/object/collaboration/create.rs | 4 +- radicle-cob/src/object/collaboration/list.rs | 10 +-- .../src/object/collaboration/update.rs | 4 +- radicle-cob/src/trailers.rs | 65 ++++++++++------- radicle-httpd/src/api/v1/projects.rs | 6 +- radicle-httpd/src/test.rs | 2 +- radicle/src/cob/op.rs | 7 +- radicle/src/cob/store.rs | 4 +- radicle/src/cob/test.rs | 4 ++ 37 files changed, 425 insertions(+), 340 deletions(-) diff --git a/radicle-cli/examples/rad-cob.md b/radicle-cli/examples/rad-cob.md index 08aa55a6..454a15ce 100644 --- a/radicle-cli/examples/rad-cob.md +++ b/radicle-cli/examples/rad-cob.md @@ -45,7 +45,7 @@ $ rad patch ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │ ● ID Title Author Head + - Updated │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● 6ff4f09 Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │ +│ ● 0f3cd0b Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ``` @@ -55,17 +55,17 @@ Both issue and patch COBs can be listed. $ rad cob list --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.issue d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 $ rad cob list --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.patch -6ff4f09c1b5a81347981f59b02ef43a31a07cdae +0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f ``` We can look at the issue COB. ``` $ 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 +commit d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 +resource 0656c217f917c3e06234771e9ecae53aba5e173e +author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +date Thu, 15 Dec 2022 17:28:04 +0000 { "body": "Flux capacitor power requirements exceed current supply", @@ -92,13 +92,13 @@ 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 6ff4f09c1b5a81347981f59b02ef43a31a07cdae -commit 6ff4f09c1b5a81347981f59b02ef43a31a07cdae -parent 0656c217f917c3e06234771e9ecae53aba5e173e -parent 3e674d1a1df90807e934f9ae5da2591dd6848a33 -parent f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 -author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi -date Thu, 15 Dec 2022 17:28:04 +0000 +$ rad cob show --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.patch --object 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f +commit 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f +resource 0656c217f917c3e06234771e9ecae53aba5e173e +rel 3e674d1a1df90807e934f9ae5da2591dd6848a33 +rel f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 +author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +date Thu, 15 Dec 2022 17:28:04 +0000 { "base": "f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354", @@ -119,3 +119,48 @@ date Thu, 15 Dec 2022 17:28:04 +0000 } ``` + +Finally let's updated the issue and see the `parent` header: + +``` +$ rad issue label d185ee1 --add bug --no-announce +$ rad cob show --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --type xyz.radicle.issue --object d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 +commit 4dd9a3dfb60665e427a43dbf289e50b7fb90a655 +resource 0656c217f917c3e06234771e9ecae53aba5e173e +parent d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 +author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +date Thu, 15 Dec 2022 17:28:04 +0000 + + { + "labels": [ + "bug" + ], + "type": "label" + } + +commit d185ee16a00bac874c0bcbc2a8ad80fdce5e1e61 +resource 0656c217f917c3e06234771e9ecae53aba5e173e +author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +date Thu, 15 Dec 2022 17:28:04 +0000 + + { + "body": "Flux capacitor power requirements exceed current supply", + "type": "comment" + } + + { + "assignees": [], + "type": "assign" + } + + { + "title": "flux capacitor underpowered", + "type": "edit" + } + + { + "labels": [], + "type": "label" + } + +``` diff --git a/radicle-cli/examples/rad-id.md b/radicle-cli/examples/rad-id.md index 33a27227..f302d114 100644 --- a/radicle-cli/examples/rad-id.md +++ b/radicle-cli/examples/rad-id.md @@ -94,10 +94,10 @@ $ rad inspect --identity We can also look at the document's COB directly: ``` $ rad cob show --object 0656c217f917c3e06234771e9ecae53aba5e173e --type xyz.radicle.id --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -commit 0ca42d376bd566631083c8913cf86bec722da392 -parent 0656c217f917c3e06234771e9ecae53aba5e173e -author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi -date Thu, 15 Dec 2022 17:28:04 +0000 +commit 0ca42d376bd566631083c8913cf86bec722da392 +parent 0656c217f917c3e06234771e9ecae53aba5e173e +author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +date Thu, 15 Dec 2022 17:28:04 +0000 { "blob": "053541ba7b90534b35dd8718e0ceaa408979b02b", @@ -108,9 +108,9 @@ date Thu, 15 Dec 2022 17:28:04 +0000 "type": "revision" } -commit 0656c217f917c3e06234771e9ecae53aba5e173e -author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi -date Thu, 15 Dec 2022 17:28:04 +0000 +commit 0656c217f917c3e06234771e9ecae53aba5e173e +author z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +date Thu, 15 Dec 2022 17:28:04 +0000 { "blob": "d96f425412c9f8ad5d9a9a05c9831d0728e2338d", diff --git a/radicle-cli/examples/rad-merge-after-update.md b/radicle-cli/examples/rad-merge-after-update.md index ec435448..7fb30bcb 100644 --- a/radicle-cli/examples/rad-merge-after-update.md +++ b/radicle-cli/examples/rad-merge-after-update.md @@ -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 a1207f6e82700e42cc46c9c38c7786b18cbd2040 opened +✓ Patch b082560898736233790dedff7b1a725b18614480 opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` @@ -27,8 +27,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 a1207f6 updated to revision [...] -✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 merged +✓ Patch b082560 updated to revision [...] +✓ Patch b082560898736233790dedff7b1a725b18614480 merged To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - + 20aa5dd...954bcdb feature/1 -> patches/a1207f6e82700e42cc46c9c38c7786b18cbd2040 (forced update) + + 20aa5dd...954bcdb feature/1 -> patches/b082560898736233790dedff7b1a725b18614480 (forced update) ``` diff --git a/radicle-cli/examples/rad-merge-no-ff.md b/radicle-cli/examples/rad-merge-no-ff.md index 833dc05f..287310aa 100644 --- a/radicle-cli/examples/rad-merge-no-ff.md +++ b/radicle-cli/examples/rad-merge-no-ff.md @@ -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 a1207f6e82700e42cc46c9c38c7786b18cbd2040 opened +✓ Patch b082560898736233790dedff7b1a725b18614480 opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` @@ -36,7 +36,7 @@ committer radicle 1671125284 +0000 Finally, we push master and expect the patch to be merged. ``` (stderr) RAD_SOCKET=/dev/null $ git push rad master -✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 merged +✓ Patch b082560898736233790dedff7b1a725b18614480 merged ✓ Canonical head updated to 737a10cfa29111afeb0d43cf3545cee386b939ec To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi f2de534..737a10c master -> master diff --git a/radicle-cli/examples/rad-merge-via-push.md b/radicle-cli/examples/rad-merge-via-push.md index 79c12c29..bd49f922 100644 --- a/radicle-cli/examples/rad-merge-via-push.md +++ b/radicle-cli/examples/rad-merge-via-push.md @@ -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 a1207f6e82700e42cc46c9c38c7786b18cbd2040 opened +✓ Patch b082560898736233790dedff7b1a725b18614480 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 8357a9f1d61e80309d314491aa754969d9f47d77 opened +✓ Patch 80fe6a0c283d7209f8839c79bc90ff9ecd9fdedd 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/8357a9f1d61e80309d314491aa754969d9f47d77 - rad/patches/a1207f6e82700e42cc46c9c38c7786b18cbd2040 + rad/patches/80fe6a0c283d7209f8839c79bc90ff9ecd9fdedd + rad/patches/b082560898736233790dedff7b1a725b18614480 ``` And some remote refs: @@ -36,13 +36,13 @@ z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi    │   ├── xyz.radicle.id    │   │   └── 0656c217f917c3e06234771e9ecae53aba5e173e    │   └── xyz.radicle.patch -    │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77 -    │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040 +    │      ├── 80fe6a0c283d7209f8839c79bc90ff9ecd9fdedd +    │      └── b082560898736233790dedff7b1a725b18614480    ├── heads    │   ├── master    │   └── patches -    │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77 -    │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040 +    │      ├── 80fe6a0c283d7209f8839c79bc90ff9ecd9fdedd +    │      └── b082560898736233790dedff7b1a725b18614480    └── 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 8357a9f1d61e80309d314491aa754969d9f47d77 merged -✓ Patch a1207f6e82700e42cc46c9c38c7786b18cbd2040 merged +✓ Patch 80fe6a0c283d7209f8839c79bc90ff9ecd9fdedd merged +✓ Patch b082560898736233790dedff7b1a725b18614480 merged ✓ Canonical head updated to d6399c71702b40bae00825b3c444478d06b4e91c To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi f2de534..d6399c7 master -> master @@ -75,10 +75,10 @@ $ rad patch --merged │ ✔ [ ... ] Second change alice (you) daf349f +0 -0 now │ │ ✔ [ ... ] First change alice (you) 20aa5dd +0 -0 now │ ╰────────────────────────────────────────────────────────────────────╯ -$ rad patch show 8357a9f1d61e80309d314491aa754969d9f47d77 +$ rad patch show 80fe6a0c283d7209f8839c79bc90ff9ecd9fdedd ╭────────────────────────────────────────────────────────────────╮ │ Title Second change │ -│ Patch 8357a9f1d61e80309d314491aa754969d9f47d77 │ +│ Patch 80fe6a0c283d7209f8839c79bc90ff9ecd9fdedd │ │ Author alice (you) │ │ Head daf349ff76bedf48c5f292290b682ee7be0683cf │ │ Branches feature/2 │ @@ -88,7 +88,7 @@ $ rad patch show 8357a9f1d61e80309d314491aa754969d9f47d77 │ daf349f Second change │ ├────────────────────────────────────────────────────────────────┤ │ ● opened by alice (you) (daf349f) now │ -│ └─ ✓ merged by alice (you) at revision 8357a9f (d6399c7) now │ +│ └─ ✓ merged by alice (you) at revision 80fe6a0 (d6399c7) now │ ╰────────────────────────────────────────────────────────────────╯ ``` @@ -109,8 +109,8 @@ z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi    │   ├── xyz.radicle.id    │   │   └── 0656c217f917c3e06234771e9ecae53aba5e173e    │   └── xyz.radicle.patch -    │      ├── 8357a9f1d61e80309d314491aa754969d9f47d77 -    │      └── a1207f6e82700e42cc46c9c38c7786b18cbd2040 +    │      ├── 80fe6a0c283d7209f8839c79bc90ff9ecd9fdedd +    │      └── b082560898736233790dedff7b1a725b18614480    ├── heads    │   └── master    └── rad diff --git a/radicle-cli/examples/rad-patch-ahead-behind.md b/radicle-cli/examples/rad-patch-ahead-behind.md index 1044ce16..ea5a1c45 100644 --- a/radicle-cli/examples/rad-patch-ahead-behind.md +++ b/radicle-cli/examples/rad-patch-ahead-behind.md @@ -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 f03f6ea57890ba8937269190d559d32105b36e03 opened +✓ Patch 0d1b997bc21ffa5cb7cda244d94e1d6bfcc4a513 opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] feature/1 -> refs/patches ``` @@ -48,17 +48,17 @@ $ rad patch list ╭────────────────────────────────────────────────────────────────────────╮ │ ● ID Title Author Head + - Updated │ ├────────────────────────────────────────────────────────────────────────┤ -│ ● f03f6ea Add Alan z6MknSL…StBU8Vi (you) 5c88a79 +1 -0 now │ +│ ● 0d1b997 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 f03f6ea +$ rad patch show -v -p 0d1b997 ╭────────────────────────────────────────────────────╮ │ Title Add Alan │ -│ Patch f03f6ea57890ba8937269190d559d32105b36e03 │ +│ Patch 0d1b997bc21ffa5cb7cda244d94e1d6bfcc4a513 │ │ 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 13a3d64f00e1c3f01c4d65fe115d2a2ed57d6cb7 opened +✓ Patch f0064bba0336095123345a1f983edb72242f592c 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 13a3d64f00e1c3f01c4d65fe115d2a2ed57d6cb7 +$ rad patch show -v f0064bba0336095123345a1f983edb72242f592c ╭────────────────────────────────────────────────────╮ │ Title Add Mel │ -│ Patch 13a3d64f00e1c3f01c4d65fe115d2a2ed57d6cb7 │ +│ Patch f0064bba0336095123345a1f983edb72242f592c │ │ 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 c0083bdc7f7acda2e7a9db3134566dd385c7e88e opened +✓ Patch 9fbe7185ab3246dec08391f833fffb6c40f0760e 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 c0083bdc7f7acda2e7a9db3134566dd385c7e88e +$ rad patch show -v 9fbe7185ab3246dec08391f833fffb6c40f0760e ╭────────────────────────────────────────────────────╮ │ Title Add Mel #2 │ -│ Patch c0083bdc7f7acda2e7a9db3134566dd385c7e88e │ +│ Patch 9fbe7185ab3246dec08391f833fffb6c40f0760e │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 7f63fcbcf23fc39eea784c091ad3d20d7e4bd005 │ │ Base 5c88a79d75f5c2b4cc51ee6f163d2db91ee198d7 │ diff --git a/radicle-cli/examples/rad-patch-change-base.md b/radicle-cli/examples/rad-patch-change-base.md index 54d540ee..8b15513c 100644 --- a/radicle-cli/examples/rad-patch-change-base.md +++ b/radicle-cli/examples/rad-patch-change-base.md @@ -18,7 +18,7 @@ $ git push rad flux-capacitor-power To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new branch] flux-capacitor-power -> flux-capacitor-power $ git push rad -o patch.message="Define power requirements" -o patch.message="See details." HEAD:refs/patches -✓ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae opened +✓ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` @@ -35,7 +35,7 @@ $ git commit --message "Add README, just for the fun" ``` ``` (stderr) $ git push rad -o patch.message="Add README, just for the fun" HEAD:refs/patches -✓ Patch 11188b84720e8ab2625be2be64987311fb046573 opened +✓ Patch 3c3036d038ef50cccb9dbccb46302bf0867ba683 opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` @@ -43,10 +43,10 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE Our second patch looks like the following: ``` -$ rad patch show 11188b8 -v +$ rad patch show 3c3036d -v ╭────────────────────────────────────────────────────╮ │ Title Add README, just for the fun │ -│ Patch 11188b84720e8ab2625be2be64987311fb046573 │ +│ Patch 3c3036d038ef50cccb9dbccb46302bf0867ba683 │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ │ Base f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │ @@ -66,18 +66,18 @@ commit `3e674d1` as part of this patch, so we create a new revision with a new `base`: ``` -$ rad patch update 11188b8 -b 3e674d1 -m "Whoops, forgot to set the base" --no-announce -ea90a38b4df0b323149a06b0472ea1cf9a754dca +$ rad patch update 3c3036d -b 3e674d1 -m "Whoops, forgot to set the base" --no-announce +d94313559de9009d261135736a3c5f3f3e873b5d ``` Now, if we show the patch we can see the patch's base has changed and we have a single commit: ``` -$ rad patch show 11188b8 -v +$ rad patch show 3c3036d -v ╭─────────────────────────────────────────────────────────────────────╮ │ Title Add README, just for the fun │ -│ Patch 11188b84720e8ab2625be2be64987311fb046573 │ +│ Patch 3c3036d038ef50cccb9dbccb46302bf0867ba683 │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ │ Base 3e674d1a1df90807e934f9ae5da2591dd6848a33 │ @@ -88,6 +88,6 @@ $ rad patch show 11188b8 -v │ 27857ec Add README, just for the fun │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (27857ec) now │ -│ ↑ updated to ea90a38b4df0b323149a06b0472ea1cf9a754dca (27857ec) now │ +│ ↑ updated to d94313559de9009d261135736a3c5f3f3e873b5d (27857ec) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/examples/rad-patch-checkout-force.md b/radicle-cli/examples/rad-patch-checkout-force.md index f0e77b3b..90950c2e 100644 --- a/radicle-cli/examples/rad-patch-checkout-force.md +++ b/radicle-cli/examples/rad-patch-checkout-force.md @@ -13,7 +13,7 @@ $ git commit -v -m "Define power requirements" ``` ~alice (stderr) $ git push rad -o patch.message="Define power requirements" -o patch.message="See details." HEAD:refs/patches -✓ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae opened +✓ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f opened ✓ Synced with 1 node(s) To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches @@ -26,9 +26,9 @@ $ cd heartwood $ rad sync -f ✓ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from z6MknSL…StBU8Vi.. ✓ Fetched repository from 1 seed(s) -$ rad patch checkout 6ff4f09 --name alice-init +$ rad patch checkout 0f3cd0b --name alice-init ✓ Switched to branch alice-init -✓ Branch alice-init setup to track rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae +✓ Branch alice-init setup to track rad/patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f ``` Meanwhile, we may see some more changes that we need to make, so we @@ -45,10 +45,10 @@ $ git commit --message "Add README, just for the fun" ``` ~alice (stderr) $ git push rad -o patch.message="Add README, just for the fun" -✓ Patch 6ff4f09 updated to revision 0c0942e2ff2488617d950ede15567ca39a29972e +✓ Patch 0f3cd0b updated to revision 6e6644973e3ecd0965b7bc5743f05a5fe1c7bff9 ✓ Synced with 1 node(s) To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - 3e674d1..27857ec flux-capacitor-power -> patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae + 3e674d1..27857ec flux-capacitor-power -> patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f ``` Bob fetches these new changes and can see their branch is now behind: @@ -56,13 +56,13 @@ Bob fetches these new changes and can see their branch is now behind: ``` ~bob (stderr) $ git fetch rad From rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji - 3e674d1..27857ec patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae -> rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae + 3e674d1..27857ec patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f -> rad/patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f ``` ``` ~bob $ git status On branch alice-init -Your branch is behind 'rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae' by 1 commit, and can be fast-forwarded. +Your branch is behind 'rad/patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f' by 1 commit, and can be fast-forwarded. (use "git pull" to update your local branch) nothing to commit, working tree clean @@ -74,17 +74,17 @@ overwrite any changes. Bob can choose to use the `--force` (`-f`) flag to ensure that they are looking at the latest changes: ``` ~bob (fail) -$ rad patch checkout 6ff4f09 --name alice-init +$ rad patch checkout 0f3cd0b --name alice-init ✗ Performing checkout... ✗ Error: branch 'alice-init' already exists (use `--force` to overwrite) ``` ``` ~bob -$ rad patch checkout 6ff4f09 -f --name alice-init +$ rad patch checkout 0f3cd0b -f --name alice-init ✓ Switched to branch alice-init $ git status On branch alice-init -Your branch is up to date with 'rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae'. +Your branch is up to date with 'rad/patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f'. nothing to commit, working tree clean ``` diff --git a/radicle-cli/examples/rad-patch-checkout-revision.md b/radicle-cli/examples/rad-patch-checkout-revision.md index 9101e4e9..c81ed5b8 100644 --- a/radicle-cli/examples/rad-patch-checkout-revision.md +++ b/radicle-cli/examples/rad-patch-checkout-revision.md @@ -5,7 +5,7 @@ So first, let's add another change to the patch and a `LICENSE` file. $ touch LICENSE $ git add LICENSE $ git commit --message "Add LICENSE, just for the business" -[patch/6ff4f09 639f44a] Add LICENSE, just for the business +[patch/0f3cd0b 639f44a] Add LICENSE, just for the business 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 LICENSE $ git push rad -o patch.message="Add LICENSE, just for the business" @@ -14,13 +14,13 @@ $ git push rad -o patch.message="Add LICENSE, just for the business" We can see the list of revisions of the patch by `show`ing it: ``` -$ rad patch show 6ff4f09 +$ rad patch show 0f3cd0b ╭─────────────────────────────────────────────────────────────────────╮ │ Title Define power requirements │ -│ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae │ +│ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 639f44a25145a37f747f3c84265037a9461e44c5 │ -│ Branches patch/6ff4f09 │ +│ Branches patch/0f3cd0b │ │ Commits ahead 3, behind 0 │ │ Status open │ │ │ @@ -31,16 +31,16 @@ $ rad patch show 6ff4f09 │ 3e674d1 Define power requirements │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (3e674d1) now │ -│ ↑ updated to 0c0942e2ff2488617d950ede15567ca39a29972e (27857ec) now │ -│ ↑ updated to 2bf48de79e371014f084b5501ecc9c9c4182e7fc (639f44a) now │ +│ ↑ updated to 6e6644973e3ecd0965b7bc5743f05a5fe1c7bff9 (27857ec) now │ +│ ↑ updated to 9b707980e143c5370d5406050f04d60b705cf849 (639f44a) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` So, let's checkout the previous revision, `0c0942e2`: ``` -$ rad patch checkout 6ff4f09 --revision 0c0942e2 -f -✓ Switched to branch patch/6ff4f09 +$ rad patch checkout 0f3cd0b --revision 6e66449 -f +✓ Switched to branch patch/0f3cd0b ``` And we can confirm that the current commit corresponds to `27857ec`: diff --git a/radicle-cli/examples/rad-patch-checkout.md b/radicle-cli/examples/rad-patch-checkout.md index e550b001..b66902bd 100644 --- a/radicle-cli/examples/rad-patch-checkout.md +++ b/radicle-cli/examples/rad-patch-checkout.md @@ -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 6ff4f09c1b5a81347981f59b02ef43a31a07cdae opened +✓ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f 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 6ff4f09 -✓ Switched to branch patch/6ff4f09 -✓ Branch patch/6ff4f09 setup to track rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae +$ rad patch checkout 0f3cd0b +✓ Switched to branch patch/0f3cd0b +✓ Branch patch/0f3cd0b setup to track rad/patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f ``` Note that `rad patch checkout` can be used to switch to the patch branch @@ -40,8 +40,8 @@ as long as we haven't made changes to it. ``` $ git checkout master -q -$ rad patch checkout 6ff4f09 -✓ Switched to branch patch/6ff4f09 +$ rad patch checkout 0f3cd0b +✓ Switched to branch patch/0f3cd0b ``` Now, let's add a README too! @@ -50,7 +50,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/6ff4f09 27857ec] Add README, just for the fun +[patch/0f3cd0b 27857ec] Add README, just for the fun 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 README.md ``` @@ -59,7 +59,7 @@ We can now finish off the update: ``` (stderr) $ git push rad -o patch.message="Add README, just for the fun" -✓ Patch 6ff4f09 updated to revision 0c0942e2ff2488617d950ede15567ca39a29972e +✓ Patch 0f3cd0b updated to revision 6e6644973e3ecd0965b7bc5743f05a5fe1c7bff9 To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - 3e674d1..27857ec patch/6ff4f09 -> patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae + 3e674d1..27857ec patch/0f3cd0b -> patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f ``` diff --git a/radicle-cli/examples/rad-patch-diff.md b/radicle-cli/examples/rad-patch-diff.md index 3d7db547..c7ca7ef9 100644 --- a/radicle-cli/examples/rad-patch-diff.md +++ b/radicle-cli/examples/rad-patch-diff.md @@ -10,7 +10,7 @@ $ git commit -m "Add README" -q $ git push rad HEAD:refs/patches ``` ``` -$ rad patch diff e432b04 +$ rad patch diff b1fbd2c ╭───────────────────────────╮ │ README.md +1 ❲created❳ │ ├───────────────────────────┤ @@ -31,7 +31,7 @@ $ git commit --amend -q $ git push -f ``` ``` -$ rad patch diff e432b04 +$ rad patch diff b1fbd2c ╭─────────────────────────────╮ │ RADICLE.md +1 ❲created❳ │ ├─────────────────────────────┤ @@ -52,7 +52,7 @@ Buf if we only want to see the changes from the first revision, we can do that too. ``` -$ rad patch diff e432b04 --revision e432b04 +$ rad patch diff b1fbd2c --revision b1fbd2c ╭───────────────────────────╮ │ README.md +1 ❲created❳ │ ├───────────────────────────┤ diff --git a/radicle-cli/examples/rad-patch-draft.md b/radicle-cli/examples/rad-patch-draft.md index f4f937c9..869796ff 100644 --- a/radicle-cli/examples/rad-patch-draft.md +++ b/radicle-cli/examples/rad-patch-draft.md @@ -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 193a2540ded82245b49971de8afc89a129502c6d drafted +✓ Patch b5df71076ba95d80acb1de3a13f94995632df95e 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 193a2540ded82245b49971de8afc89a129502c6d +$ rad patch show b5df71076ba95d80acb1de3a13f94995632df95e ╭────────────────────────────────────────────────────╮ │ Title Nothing yet │ -│ Patch 193a2540ded82245b49971de8afc89a129502c6d │ +│ Patch b5df71076ba95d80acb1de3a13f94995632df95e │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │ │ Branches cloudhead/draft │ @@ -36,14 +36,14 @@ $ rad patch show 193a2540ded82245b49971de8afc89a129502c6d Once the patch is ready for review, we can use the `ready` command: ``` -$ rad patch ready 193a2540ded82245b49971de8afc89a129502c6d --no-announce +$ rad patch ready b5df71076ba95d80acb1de3a13f94995632df95e --no-announce ``` ``` -$ rad patch show 193a2540ded82245b49971de8afc89a129502c6d +$ rad patch show b5df71076ba95d80acb1de3a13f94995632df95e ╭────────────────────────────────────────────────────╮ │ Title Nothing yet │ -│ Patch 193a2540ded82245b49971de8afc89a129502c6d │ +│ Patch b5df71076ba95d80acb1de3a13f94995632df95e │ │ 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 193a2540ded82245b49971de8afc89a129502c6d --no-announce -$ rad patch show 193a2540ded82245b49971de8afc89a129502c6d +$ rad patch ready --undo b5df71076ba95d80acb1de3a13f94995632df95e --no-announce +$ rad patch show b5df71076ba95d80acb1de3a13f94995632df95e ╭────────────────────────────────────────────────────╮ │ Title Nothing yet │ -│ Patch 193a2540ded82245b49971de8afc89a129502c6d │ +│ Patch b5df71076ba95d80acb1de3a13f94995632df95e │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 2a465832b5a76abe25be44a3a5d224bbd7741ba7 │ │ Branches cloudhead/draft │ diff --git a/radicle-cli/examples/rad-patch-edit.md b/radicle-cli/examples/rad-patch-edit.md index 0779982d..2030a1b3 100644 --- a/radicle-cli/examples/rad-patch-edit.md +++ b/radicle-cli/examples/rad-patch-edit.md @@ -16,7 +16,7 @@ $ git commit --message "Add README, just for the fun" ``` (stderr) $ git push rad -o patch.message="Add README, just for the fun" HEAD:refs/patches -✓ Patch 0631b2d1b5cd4ae44e92732ff3929528354a8405 opened +✓ Patch 59e17793443e35a5e76b3dd58d419d316d8211ee opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` @@ -32,18 +32,18 @@ $ git commit -v -m "Define the LICENSE" ``` (stderr) $ git push -f -o patch.message="Add License" -✓ Patch 0631b2d updated to revision bbc91fd4c74bfbbb162ec4b97cd8cefe623814d7 +✓ Patch 59e1779 updated to revision 7169d286cc0e3060ef97639c92b7c951260ade74 To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - 03c02af..8945f61 changes -> patches/0631b2d1b5cd4ae44e92732ff3929528354a8405 + 03c02af..8945f61 changes -> patches/59e17793443e35a5e76b3dd58d419d316d8211ee ``` Let's look at the patch, to see what it looks like before editing it: ``` -$ rad patch show 0631b2d +$ rad patch show 59e1779 ╭─────────────────────────────────────────────────────────────────────╮ │ Title Add README, just for the fun │ -│ Patch 0631b2d1b5cd4ae44e92732ff3929528354a8405 │ +│ Patch 59e17793443e35a5e76b3dd58d419d316d8211ee │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 8945f6189adf027892c85ac57f7e9341049c2537 │ │ Branches changes │ @@ -54,7 +54,7 @@ $ rad patch show 0631b2d │ 03c02af Add README, just for the fun │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (03c02af) now │ -│ ↑ updated to bbc91fd4c74bfbbb162ec4b97cd8cefe623814d7 (8945f61) now │ +│ ↑ updated to 7169d286cc0e3060ef97639c92b7c951260ade74 (8945f61) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` @@ -62,11 +62,11 @@ We can change the title and description of the patch itself by using a multi-line message (using two `--message` options here): ``` -$ rad patch edit 0631b2d --message "Add Metadata" --message "Add README & LICENSE" --no-announce -$ rad patch show 0631b2d +$ rad patch edit 59e1779 --message "Add Metadata" --message "Add README & LICENSE" --no-announce +$ rad patch show 59e1779 ╭─────────────────────────────────────────────────────────────────────╮ │ Title Add Metadata │ -│ Patch 0631b2d1b5cd4ae44e92732ff3929528354a8405 │ +│ Patch 59e17793443e35a5e76b3dd58d419d316d8211ee │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 8945f6189adf027892c85ac57f7e9341049c2537 │ │ Branches changes │ @@ -79,7 +79,7 @@ $ rad patch show 0631b2d │ 03c02af Add README, just for the fun │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (03c02af) now │ -│ ↑ updated to bbc91fd4c74bfbbb162ec4b97cd8cefe623814d7 (8945f61) now │ +│ ↑ updated to 7169d286cc0e3060ef97639c92b7c951260ade74 (8945f61) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` @@ -90,11 +90,11 @@ If we want to change a specific revision's description, we can use the `--revision` option: ``` -$ rad patch edit 0631b2d --revision bbc91fd --message "Changes: Adds LICENSE file" --no-announce -$ rad patch show 0631b2d +$ rad patch edit 59e1779 --revision 7169d28 --message "Changes: Adds LICENSE file" --no-announce +$ rad patch show 59e1779 ╭─────────────────────────────────────────────────────────────────────╮ │ Title Add Metadata │ -│ Patch 0631b2d1b5cd4ae44e92732ff3929528354a8405 │ +│ Patch 59e17793443e35a5e76b3dd58d419d316d8211ee │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 8945f6189adf027892c85ac57f7e9341049c2537 │ │ Branches changes │ @@ -107,7 +107,7 @@ $ rad patch show 0631b2d │ 03c02af Add README, just for the fun │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (03c02af) now │ -│ ↑ updated to bbc91fd4c74bfbbb162ec4b97cd8cefe623814d7 (8945f61) now │ +│ ↑ updated to 7169d286cc0e3060ef97639c92b7c951260ade74 (8945f61) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/examples/rad-patch-fetch-2.md b/radicle-cli/examples/rad-patch-fetch-2.md index 45efc2ea..54ad10de 100644 --- a/radicle-cli/examples/rad-patch-fetch-2.md +++ b/radicle-cli/examples/rad-patch-fetch-2.md @@ -12,7 +12,7 @@ $ git push rad -o patch.message="Changes" HEAD:refs/patches $ git checkout master -q $ git branch -D alice/1 -q $ git update-ref -d refs/remotes/rad/alice/1 -$ git update-ref -d refs/remotes/rad/patches/34dff44b9e86f0bdb1a65ee5b6ef90ce6e7af70d +$ git update-ref -d refs/remotes/rad/patches/eebe0783450d21db6e2a956b586fb728e747b12e $ git gc --prune=now $ git branch -r rad/master @@ -23,5 +23,5 @@ $ git pull Already up to date. $ git branch -r rad/master - rad/patches/34dff44b9e86f0bdb1a65ee5b6ef90ce6e7af70d + rad/patches/eebe0783450d21db6e2a956b586fb728e747b12e ``` diff --git a/radicle-cli/examples/rad-patch-merge-draft.md b/radicle-cli/examples/rad-patch-merge-draft.md index ee72816d..b9649942 100644 --- a/radicle-cli/examples/rad-patch-merge-draft.md +++ b/radicle-cli/examples/rad-patch-merge-draft.md @@ -4,7 +4,7 @@ Let's start by creating a draft patch. $ git checkout -b feature/1 -q $ git commit --allow-empty -q -m "First change" $ git push -o patch.draft rad HEAD:refs/patches -✓ Patch cf29ac6b10141058be66b94a92a81c703b972751 drafted +✓ Patch d3b1d28d4c566e81ea3b8dcd2a23faef3e2471a5 drafted To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` @@ -13,7 +13,7 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE $ git checkout master -q $ git merge feature/1 $ git push rad master -✓ Patch cf29ac6b10141058be66b94a92a81c703b972751 merged +✓ Patch d3b1d28d4c566e81ea3b8dcd2a23faef3e2471a5 merged ✓ Canonical head updated to 20aa5dde6210796c3a2f04079b42316a31d02689 To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi f2de534..20aa5dd master -> master diff --git a/radicle-cli/examples/rad-patch-open-explore.md b/radicle-cli/examples/rad-patch-open-explore.md index a5dad59a..e67b61ee 100644 --- a/radicle-cli/examples/rad-patch-open-explore.md +++ b/radicle-cli/examples/rad-patch-open-explore.md @@ -4,10 +4,10 @@ When preferred seeds are configured, opening a patch outputs the patch URL. $ git checkout -b changes -q $ git commit --allow-empty -q -m "Changes" $ git push rad HEAD:refs/patches -✓ Patch e0b35c56eb265d49cddd72d91cf873f64037d96c opened +✓ Patch 806276a013152675fe4361e6c15275bd5c8d43b4 opened ✓ Synced with 1 node(s) - https://app.radicle.xyz/nodes/[..]/rad:z3yXbb1sR6UG6ixxV2YF9jUP7ABra/patches/e0b35c56eb265d49cddd72d91cf873f64037d96c + https://app.radicle.xyz/nodes/[..]/rad:z3yXbb1sR6UG6ixxV2YF9jUP7ABra/patches/806276a013152675fe4361e6c15275bd5c8d43b4 To rad://z3yXbb1sR6UG6ixxV2YF9jUP7ABra/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk * [new reference] HEAD -> refs/patches @@ -18,13 +18,13 @@ If we update the patch, the URL is also output. ``` (stderr) $ git commit --amend --allow-empty -q -m "Other changes" $ git push -f -✓ Patch e0b35c5 updated to revision 0ab4697ba5beee387f1211bdf0880a06564842ce +✓ Patch 806276a updated to revision 374490d831db6574ddf9e4b8a8a3ef81e6783907 ✓ Synced with 1 node(s) - https://app.radicle.xyz/nodes/[..]/rad:z3yXbb1sR6UG6ixxV2YF9jUP7ABra/patches/e0b35c56eb265d49cddd72d91cf873f64037d96c + https://app.radicle.xyz/nodes/[..]/rad:z3yXbb1sR6UG6ixxV2YF9jUP7ABra/patches/806276a013152675fe4361e6c15275bd5c8d43b4 To rad://z3yXbb1sR6UG6ixxV2YF9jUP7ABra/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk - + e12525d...b2b6432 changes -> patches/e0b35c56eb265d49cddd72d91cf873f64037d96c (forced update) + + e12525d...b2b6432 changes -> patches/806276a013152675fe4361e6c15275bd5c8d43b4 (forced update) ``` While simply pushing a commit outputs a URL to the new source tree. @@ -33,7 +33,7 @@ While simply pushing a commit outputs a URL to the new source tree. $ git checkout master -q $ git merge changes -q $ git push rad master -✓ Patch e0b35c56eb265d49cddd72d91cf873f64037d96c merged +✓ Patch 806276a013152675fe4361e6c15275bd5c8d43b4 merged ✓ Canonical head updated to b2b6432af93f8fe188e32d400263021b602cfec8 ✓ Synced with 1 node(s) diff --git a/radicle-cli/examples/rad-patch-pull-update.md b/radicle-cli/examples/rad-patch-pull-update.md index b33db60f..19731faf 100644 --- a/radicle-cli/examples/rad-patch-pull-update.md +++ b/radicle-cli/examples/rad-patch-pull-update.md @@ -53,22 +53,22 @@ Bob then opens a patch. $ 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 48c30356be83049458c0608d5a6f84789e9dc1d0 opened +✓ Patch d83a9a0e808dea392a10c0a62246484a18842039 opened ✓ Synced with 1 node(s) To rad://zhbMU4DUXrzB8xT6qAJh6yZ7bFMK/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk * [new reference] HEAD -> refs/patches ``` ``` ~bob $ git status --short --branch -## bob/feature...rad/patches/48c30356be83049458c0608d5a6f84789e9dc1d0 +## bob/feature...rad/patches/d83a9a0e808dea392a10c0a62246484a18842039 ``` Alice checks it out. ``` ~alice -$ rad patch checkout 48c3035 -✓ Switched to branch patch/48c3035 -✓ Branch patch/48c3035 setup to track rad/patches/48c30356be83049458c0608d5a6f84789e9dc1d0 +$ rad patch checkout d83a9a0 +✓ Switched to branch patch/d83a9a0 +✓ Branch patch/d83a9a0 setup to track rad/patches/d83a9a0e808dea392a10c0a62246484a18842039 $ git show commit bdcdb30b3c0f513620dd0f1c24ff8f4f71de956b Author: radicle @@ -82,19 +82,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 48c3035 updated to revision 8c15a61af45f561b4bf0694aee03ade34a1b18f5 +✓ Patch d83a9a0 updated to revision 37d68f4660541fc4fcbba5b7f81cc8f79b6cb05c ✓ Synced with 1 node(s) To rad://zhbMU4DUXrzB8xT6qAJh6yZ7bFMK/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk - bdcdb30..cad2666 bob/feature -> patches/48c30356be83049458c0608d5a6f84789e9dc1d0 + bdcdb30..cad2666 bob/feature -> patches/d83a9a0e808dea392a10c0a62246484a18842039 ``` Alice pulls the update. ``` ~alice -$ rad patch show 48c3035 +$ rad patch show d83a9a0 ╭─────────────────────────────────────────────────────────────────────╮ │ Title Bob's patch │ -│ Patch 48c30356be83049458c0608d5a6f84789e9dc1d0 │ +│ Patch d83a9a0e808dea392a10c0a62246484a18842039 │ │ Author bob z6Mkt67…v4N1tRk │ │ Head cad2666a8a2250e4dee175ed5044be2c251ff08b │ │ Commits ahead 2, behind 0 │ @@ -104,16 +104,16 @@ $ rad patch show 48c3035 │ bdcdb30 Bob's commit #1 │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by bob z6Mkt67…v4N1tRk (bdcdb30) now │ -│ ↑ updated to 8c15a61af45f561b4bf0694aee03ade34a1b18f5 (cad2666) now │ +│ ↑ updated to 37d68f4660541fc4fcbba5b7f81cc8f79b6cb05c (cad2666) now │ ╰─────────────────────────────────────────────────────────────────────╯ $ git ls-remote rad f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master -cad2666a8a2250e4dee175ed5044be2c251ff08b refs/heads/patches/48c30356be83049458c0608d5a6f84789e9dc1d0 +cad2666a8a2250e4dee175ed5044be2c251ff08b refs/heads/patches/d83a9a0e808dea392a10c0a62246484a18842039 ``` ``` ~alice $ git fetch rad $ git status --short --branch -## patch/48c3035...rad/patches/48c30356be83049458c0608d5a6f84789e9dc1d0 [behind 1] +## patch/d83a9a0...rad/patches/d83a9a0e808dea392a10c0a62246484a18842039 [behind 1] ``` ``` ~alice $ git pull diff --git a/radicle-cli/examples/rad-patch-update.md b/radicle-cli/examples/rad-patch-update.md index 8bd41baa..0fe036a2 100644 --- a/radicle-cli/examples/rad-patch-update.md +++ b/radicle-cli/examples/rad-patch-update.md @@ -6,16 +6,16 @@ $ git commit -q -m "Not a real change" --allow-empty ``` ``` (stderr) $ git push rad HEAD:refs/patches -✓ Patch 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 opened +✓ Patch bbe51b0a6b0edb6836eec7ca6fe9e8e918b05954 opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` ``` -$ rad patch show 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 +$ rad patch show bbe51b0a6b0edb6836eec7ca6fe9e8e918b05954 ╭────────────────────────────────────────────────────╮ │ Title Not a real change │ -│ Patch 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 │ +│ Patch bbe51b0a6b0edb6836eec7ca6fe9e8e918b05954 │ │ 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 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 -m "Updated patch" --no-announce -74d453f93d81bb535ffa4ef65c46e5bd0a76015d +$ rad patch update bbe51b0a6b0edb6836eec7ca6fe9e8e918b05954 -m "Updated patch" --no-announce +c5fa2b805fa9dd61c999a810c35d39081b586472 ``` The command outputs the new Revision ID, which we can now see here: ``` -$ rad patch show 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 +$ rad patch show bbe51b0a6b0edb6836eec7ca6fe9e8e918b05954 ╭─────────────────────────────────────────────────────────────────────╮ │ Title Not a real change │ -│ Patch 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 │ +│ Patch bbe51b0a6b0edb6836eec7ca6fe9e8e918b05954 │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 4d272148458a17620541555b1f0905c01658aa9f │ │ Branches feature/1 │ @@ -67,6 +67,6 @@ $ rad patch show 8f5dcedc07a89928fd450bce1479f2559bcfd1d4 │ 51b2f0f Not a real change │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (51b2f0f) now │ -│ ↑ updated to 74d453f93d81bb535ffa4ef65c46e5bd0a76015d (4d27214) now │ +│ ↑ updated to c5fa2b805fa9dd61c999a810c35d39081b586472 (4d27214) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/examples/rad-patch-via-push.md b/radicle-cli/examples/rad-patch-via-push.md index 7969081b..3439962b 100644 --- a/radicle-cli/examples/rad-patch-via-push.md +++ b/radicle-cli/examples/rad-patch-via-push.md @@ -8,8 +8,8 @@ $ 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 82faae29b2a2f11bf45bbba4c4787d6b32a12447 opened -hint: to update, run `git push` or `git push rad -f HEAD:patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447` +✓ Patch d43d4eeffedad8411d9e077208464156fd2fe1f0 opened +hint: to update, run `git push` or `git push rad -f HEAD:patches/d43d4eeffedad8411d9e077208464156fd2fe1f0` hint: offline push, your node is not running hint: to sync with the network, run `rad node start` To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi @@ -19,10 +19,10 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE We can see a patch was created: ``` -$ rad patch show 82faae29b2a2f11bf45bbba4c4787d6b32a12447 +$ rad patch show d43d4eeffedad8411d9e077208464156fd2fe1f0 ╭────────────────────────────────────────────────────╮ │ Title Add things #1 │ -│ Patch 82faae29b2a2f11bf45bbba4c4787d6b32a12447 │ +│ Patch d43d4eeffedad8411d9e077208464156fd2fe1f0 │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 42d894a83c9c356552a57af09ccdbd5587a99045 │ │ Branches feature/1 │ @@ -42,7 +42,7 @@ branch associated with this patch: ``` $ git branch -vv -* feature/1 42d894a [rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447] Add things +* feature/1 42d894a [rad/patches/d43d4eeffedad8411d9e077208464156fd2fe1f0] Add things master f2de534 [rad/master] Second commit ``` @@ -50,7 +50,7 @@ Let's check that it's up to date with our local head: ``` $ git status --short --branch -## feature/1...rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447 +## feature/1...rad/patches/d43d4eeffedad8411d9e077208464156fd2fe1f0 $ git fetch $ git push ``` @@ -62,14 +62,14 @@ $ git show-ref 42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/feature/1 f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/heads/master f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 refs/remotes/rad/master -42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447 +42d894a83c9c356552a57af09ccdbd5587a99045 refs/remotes/rad/patches/d43d4eeffedad8411d9e077208464156fd2fe1f0 ``` ``` $ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji 'refs/heads/patches/*' -42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447 +42d894a83c9c356552a57af09ccdbd5587a99045 refs/heads/patches/d43d4eeffedad8411d9e077208464156fd2fe1f0 $ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi 'refs/cobs/*' 0656c217f917c3e06234771e9ecae53aba5e173e refs/cobs/xyz.radicle.id/0656c217f917c3e06234771e9ecae53aba5e173e -82faae29b2a2f11bf45bbba4c4787d6b32a12447 refs/cobs/xyz.radicle.patch/82faae29b2a2f11bf45bbba4c4787d6b32a12447 +d43d4eeffedad8411d9e077208464156fd2fe1f0 refs/cobs/xyz.radicle.patch/d43d4eeffedad8411d9e077208464156fd2fe1f0 ``` We can create another patch: @@ -78,7 +78,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 b77b2e8a05adcdc859a0184f7db859df1c6686b6 opened +✓ Patch 178c07e0b0ae3cc082438952085397d2aae9500a opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` @@ -87,8 +87,8 @@ We see both branches with upstreams now: ``` $ git branch -vv - feature/1 42d894a [rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447] Add things -* feature/2 8b0ea80 [rad/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6] Add more things + feature/1 42d894a [rad/patches/d43d4eeffedad8411d9e077208464156fd2fe1f0] Add things +* feature/2 8b0ea80 [rad/patches/178c07e0b0ae3cc082438952085397d2aae9500a] Add more things master f2de534 [rad/master] Second commit ``` @@ -99,8 +99,8 @@ $ rad patch ╭───────────────────────────────────────────────────────────────────────────────╮ │ ● ID Title Author Head + - Updated │ ├───────────────────────────────────────────────────────────────────────────────┤ -│ ● 82faae2 Add things #1 z6MknSL…StBU8Vi (you) 42d894a +0 -0 now │ -│ ● b77b2e8 Add more things z6MknSL…StBU8Vi (you) 8b0ea80 +0 -0 now │ +│ ● 178c07e Add more things z6MknSL…StBU8Vi (you) 8b0ea80 +0 -0 now │ +│ ● d43d4ee Add things #1 z6MknSL…StBU8Vi (you) 42d894a +0 -0 now │ ╰───────────────────────────────────────────────────────────────────────────────╯ ``` @@ -112,9 +112,9 @@ $ git commit -a -m "Improve code" -q --allow-empty ``` (stderr) $ git push rad -✓ Patch b77b2e8 updated to revision 8d6692ce2b2219a54d09ccd5feefedb2bae33eba +✓ Patch 178c07e updated to revision f82a63ebfcda8b43f2119d5fcadbe52e07c3272e To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - 8b0ea80..02bef3f feature/2 -> patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 + 8b0ea80..02bef3f feature/2 -> patches/178c07e0b0ae3cc082438952085397d2aae9500a ``` This last `git push` worked without specifying an upstream branch despite the @@ -132,10 +132,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 b77b2e8 +$ rad patch show 178c07e ╭─────────────────────────────────────────────────────────────────────╮ │ Title Add more things │ -│ Patch b77b2e8a05adcdc859a0184f7db859df1c6686b6 │ +│ Patch 178c07e0b0ae3cc082438952085397d2aae9500a │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 02bef3fac41b2f98bb3c02b868a53ddfecb55b5f │ │ Branches feature/2 │ @@ -146,7 +146,7 @@ $ rad patch show b77b2e8 │ 8b0ea80 Add more things │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (8b0ea80) now │ -│ ↑ updated to 8d6692ce2b2219a54d09ccd5feefedb2bae33eba (02bef3f) now │ +│ ↑ updated to f82a63ebfcda8b43f2119d5fcadbe52e07c3272e (02bef3f) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` @@ -159,14 +159,14 @@ $ git rev-parse HEAD ``` $ git status --short --branch -## feature/2...rad/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 +## feature/2...rad/patches/178c07e0b0ae3cc082438952085397d2aae9500a ``` ``` -$ git rev-parse refs/remotes/rad/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 +$ git rev-parse refs/remotes/rad/patches/178c07e0b0ae3cc082438952085397d2aae9500a 02bef3fac41b2f98bb3c02b868a53ddfecb55b5f -$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi refs/heads/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 -02bef3fac41b2f98bb3c02b868a53ddfecb55b5f refs/heads/patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 +$ git ls-remote rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi refs/heads/patches/178c07e0b0ae3cc082438952085397d2aae9500a +02bef3fac41b2f98bb3c02b868a53ddfecb55b5f refs/heads/patches/178c07e0b0ae3cc082438952085397d2aae9500a ``` ## Force push @@ -187,7 +187,7 @@ Now let's push to the patch head. ``` (stderr) (fail) $ git push To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - ! [rejected] feature/2 -> patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 (non-fast-forward) + ! [rejected] feature/2 -> patches/178c07e0b0ae3cc082438952085397d2aae9500a (non-fast-forward) error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi' hint: [..] hint: [..] @@ -200,18 +200,18 @@ use `--force` to force the update. ``` (stderr) $ git push --force -✓ Patch b77b2e8 updated to revision 8438ab3940316abe65c93982a0a8f39688400359 +✓ Patch 178c07e updated to revision d125e0b78e1e496d7653d220d09354b1b434a3ab To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - + 02bef3f...9304dbc feature/2 -> patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6 (forced update) + + 02bef3f...9304dbc feature/2 -> patches/178c07e0b0ae3cc082438952085397d2aae9500a (forced update) ``` That worked. We can see the new revision if we call `rad patch show`: ``` -$ rad patch show b77b2e8 +$ rad patch show 178c07e ╭─────────────────────────────────────────────────────────────────────╮ │ Title Add more things │ -│ Patch b77b2e8a05adcdc859a0184f7db859df1c6686b6 │ +│ Patch 178c07e0b0ae3cc082438952085397d2aae9500a │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 9304dbc445925187994a7a93222a3f8bde73b785 │ │ Branches feature/2 │ @@ -222,8 +222,8 @@ $ rad patch show b77b2e8 │ 8b0ea80 Add more things │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (8b0ea80) now │ -│ ↑ updated to 8d6692ce2b2219a54d09ccd5feefedb2bae33eba (02bef3f) now │ -│ ↑ updated to 8438ab3940316abe65c93982a0a8f39688400359 (9304dbc) now │ +│ ↑ updated to f82a63ebfcda8b43f2119d5fcadbe52e07c3272e (02bef3f) now │ +│ ↑ updated to d125e0b78e1e496d7653d220d09354b1b434a3ab (9304dbc) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/examples/rad-patch.md b/radicle-cli/examples/rad-patch.md index 1c7382a2..87994a6b 100644 --- a/radicle-cli/examples/rad-patch.md +++ b/radicle-cli/examples/rad-patch.md @@ -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 6ff4f09c1b5a81347981f59b02ef43a31a07cdae opened +✓ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi * [new reference] HEAD -> refs/patches ``` @@ -38,14 +38,14 @@ $ rad patch ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │ ● ID Title Author Head + - Updated │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● 6ff4f09 Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │ +│ ● 0f3cd0b Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ``` ``` -$ rad patch show 6ff4f09c1b5a81347981f59b02ef43a31a07cdae -p +$ rad patch show 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f -p ╭────────────────────────────────────────────────────╮ │ Title Define power requirements │ -│ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae │ +│ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f │ │ Author z6MknSL…StBU8Vi (you) │ │ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │ │ Branches flux-capacitor-power │ @@ -78,14 +78,14 @@ $ rad patch list --authored ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │ ● ID Title Author Head + - Updated │ ├─────────────────────────────────────────────────────────────────────────────────────────┤ -│ ● 6ff4f09 Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │ +│ ● 0f3cd0b Define power requirements z6MknSL…StBU8Vi (you) 3e674d1 +0 -0 now │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ``` We can also see that it set an upstream for our patch branch: ``` $ git branch -vv -* flux-capacitor-power 3e674d1 [rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae] Define power requirements +* flux-capacitor-power 3e674d1 [rad/patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f] Define power requirements master f2de534 [rad/master] Second commit ``` @@ -93,12 +93,12 @@ We can also label patches as well as assign DIDs to the patch to help organise your workflow: ``` -$ rad patch label 6ff4f09 --add fun --no-announce -$ rad patch assign 6ff4f09 --add did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --no-announce -$ rad patch show 6ff4f09 +$ rad patch label 0f3cd0b --add fun --no-announce +$ rad patch assign 0f3cd0b --add did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --no-announce +$ rad patch show 0f3cd0b ╭────────────────────────────────────────────────────╮ │ Title Define power requirements │ -│ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae │ +│ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f │ │ Author z6MknSL…StBU8Vi (you) │ │ Labels fun │ │ Head 3e674d1a1df90807e934f9ae5da2591dd6848a33 │ @@ -126,49 +126,49 @@ $ git commit --message "Add README, just for the fun" ``` ``` (stderr) $ git push rad -o patch.message="Add README, just for the fun" -✓ Patch 6ff4f09 updated to revision e0fd9f00b51e10e1ca88868e68e46e859ed371d7 +✓ Patch 0f3cd0b updated to revision 8144632f7cc54793386279283a24565f5841e9f8 To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - 3e674d1..27857ec flux-capacitor-power -> patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae + 3e674d1..27857ec flux-capacitor-power -> patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f ``` And let's leave a quick comment for our team: ``` -$ rad patch comment 6ff4f09 --message 'I cannot wait to get back to the 90s!' --no-announce +$ rad patch comment 0f3cd0b --message 'I cannot wait to get back to the 90s!' --no-announce ╭───────────────────────────────────────╮ -│ z6MknSL…StBU8Vi (you) now f5b4613 │ +│ z6MknSL…StBU8Vi (you) now 0f81124 │ │ I cannot wait to get back to the 90s! │ ╰───────────────────────────────────────╯ -$ rad patch comment 6ff4f09 --message 'My favorite decade!' --reply-to f5b4613 -q --no-announce -611df66ccb3803b604a59f2efa9a42d72256dd49 +$ rad patch comment 0f3cd0b --message 'My favorite decade!' --reply-to 0f81124 -q --no-announce +7e96054a98a2dc4e3c66cd16479cbe9adf7015dc ``` Now, let's checkout the patch that we just created: ``` -$ rad patch checkout 6ff4f09 -✓ Switched to branch patch/6ff4f09 -✓ Branch patch/6ff4f09 setup to track rad/patches/6ff4f09c1b5a81347981f59b02ef43a31a07cdae +$ rad patch checkout 0f3cd0b +✓ Switched to branch patch/0f3cd0b +✓ Branch patch/0f3cd0b setup to track rad/patches/0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f ``` We can also add a review verdict as such: ``` -$ rad patch review 6ff4f09 --accept --no-message --no-announce -✓ Patch 6ff4f09 accepted +$ rad patch review 0f3cd0b --accept --no-message --no-announce +✓ Patch 0f3cd0b accepted ``` Showing the patch list now will reveal the favorable verdict: ``` -$ rad patch show 6ff4f09 +$ rad patch show 0f3cd0b ╭─────────────────────────────────────────────────────────────────────╮ │ Title Define power requirements │ -│ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae │ +│ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f │ │ Author z6MknSL…StBU8Vi (you) │ │ Labels fun │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ -│ Branches flux-capacitor-power, patch/6ff4f09 │ +│ Branches flux-capacitor-power, patch/0f3cd0b │ │ Commits ahead 2, behind 0 │ │ Status open │ │ │ @@ -178,7 +178,7 @@ $ rad patch show 6ff4f09 │ 3e674d1 Define power requirements │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (3e674d1) now │ -│ ↑ updated to e0fd9f00b51e10e1ca88868e68e46e859ed371d7 (27857ec) now │ +│ ↑ updated to 8144632f7cc54793386279283a24565f5841e9f8 (27857ec) now │ │ └─ ✓ accepted by z6MknSL…StBU8Vi (you) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` @@ -186,15 +186,15 @@ $ rad patch show 6ff4f09 If you make a mistake on the patch description, you can always change it! ``` -$ rad patch edit 6ff4f09 --message "Define power requirements" --message "Add requirements file" --no-announce -$ rad patch show 6ff4f09 +$ rad patch edit 0f3cd0b --message "Define power requirements" --message "Add requirements file" --no-announce +$ rad patch show 0f3cd0b ╭─────────────────────────────────────────────────────────────────────╮ │ Title Define power requirements │ -│ Patch 6ff4f09c1b5a81347981f59b02ef43a31a07cdae │ +│ Patch 0f3cd0b3a69c8f70bfa2d3366122c07704e5bb5f │ │ Author z6MknSL…StBU8Vi (you) │ │ Labels fun │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ -│ Branches flux-capacitor-power, patch/6ff4f09 │ +│ Branches flux-capacitor-power, patch/0f3cd0b │ │ Commits ahead 2, behind 0 │ │ Status open │ │ │ @@ -204,7 +204,7 @@ $ rad patch show 6ff4f09 │ 3e674d1 Define power requirements │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by z6MknSL…StBU8Vi (you) (3e674d1) now │ -│ ↑ updated to e0fd9f00b51e10e1ca88868e68e46e859ed371d7 (27857ec) now │ +│ ↑ updated to 8144632f7cc54793386279283a24565f5841e9f8 (27857ec) now │ │ └─ ✓ accepted by z6MknSL…StBU8Vi (you) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/examples/rad-push-and-pull-patches.md b/radicle-cli/examples/rad-push-and-pull-patches.md index afffd1e9..c12ec4d8 100644 --- a/radicle-cli/examples/rad-push-and-pull-patches.md +++ b/radicle-cli/examples/rad-push-and-pull-patches.md @@ -12,9 +12,9 @@ $ git checkout -b alice/1 -q $ git rev-parse HEAD f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 $ git checkout master -q -$ rad patch checkout 0fd67a0 -✓ Switched to branch patch/0fd67a0 -✓ Branch patch/0fd67a0 setup to track rad/patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21 +$ rad patch checkout 4895eaa +✓ Switched to branch patch/4895eaa +✓ Branch patch/4895eaa setup to track rad/patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ✓ Follow policy updated for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ✓ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from z6Mkt67…v4N1tRk.. @@ -23,19 +23,19 @@ $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ git checkout master -q $ cat .git/FETCH_HEAD f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 not-for-merge branch 'master' of rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk -8d5f1bae4b69d8e3f6cbfc6f4bd675ed19990afc not-for-merge branch 'patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21' of rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk +8d5f1bae4b69d8e3f6cbfc6f4bd675ed19990afc not-for-merge branch 'patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d' of rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ git rev-parse master f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 ``` ``` ~alice (stderr) -$ git checkout patch/0fd67a0 -q +$ git checkout patch/4895eaa -q $ git commit --allow-empty -m "Changes #2" -q $ git push -✓ Patch 0fd67a0 updated to revision c360232989049f6d95efe3512e68608317333a5e +✓ Patch 4895eaa updated to revision aa9f560826c79344536fae8770687b9d4fbb99cd ✓ Synced with 1 node(s) To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - * [new branch] patch/0fd67a0 -> patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21 + * [new branch] patch/4895eaa -> patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d ``` ``` ~bob @@ -47,27 +47,27 @@ $ git push $ git checkout master -q $ git pull From rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji - + c2aaf1c...8d5f1ba patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21 -> rad/patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21 (forced update) + + c2aaf1c...8d5f1ba patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d -> rad/patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d (forced update) $ git checkout - -q $ git commit --allow-empty -m "Changes #3" -q $ git push -✓ Patch 0fd67a0 updated to revision c4115970191cd0e67212b6d26ad9e3bd992dce35 +✓ Patch 4895eaa updated to revision 9f997dc90ecc5e8a0562a81356ed0432fe3bdaf8 ✓ Synced with 1 node(s) To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - c2aaf1c..d9f8caf patch/0fd67a0 -> patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21 + c2aaf1c..d9f8caf patch/4895eaa -> patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d ``` ``` ~alice $ cat .git/FETCH_HEAD f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 branch 'master' of rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji -8d5f1bae4b69d8e3f6cbfc6f4bd675ed19990afc not-for-merge branch 'patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21' of rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji +8d5f1bae4b69d8e3f6cbfc6f4bd675ed19990afc not-for-merge branch 'patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d' of rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji ``` ``` ~bob (stderr) $ git checkout master -q $ git pull From rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji - + c2aaf1c...8d5f1ba patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21 -> rad/patches/0fd67a0364af1f79ed8770a35ed09d85571d4c21 (forced update) + + c2aaf1c...8d5f1ba patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d -> rad/patches/4895eaa8c751e0cd75ce5ef39c65e0cc05b7235d (forced update) ``` ``` ~bob diff --git a/radicle-cli/examples/rad-review-by-hunk.md b/radicle-cli/examples/rad-review-by-hunk.md index f1ed8710..c9da22d7 100644 --- a/radicle-cli/examples/rad-review-by-hunk.md +++ b/radicle-cli/examples/rad-review-by-hunk.md @@ -61,7 +61,7 @@ $ git commit -q -m "Update files" ``` (stderr) $ git push rad HEAD:refs/patches -✓ Patch 52da8356aa9beec08e6943cb3c4063fa37f3241b opened +✓ Patch 09f4d8b2335190a38d462373f197492ce3e9c3ca 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 patch review --patch -U5 52da8356aa9beec08e6943cb3c4063fa37f3241b --no-announce +$ rad patch review --patch -U5 09f4d8b2335190a38d462373f197492ce3e9c3ca --no-announce 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 patch review --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b --no-announce -✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept --hunk 1 09f4d8b2335190a38d462373f197492ce3e9c3ca --no-announce +✓ Loaded existing review ([..]) for patch 09f4d8b2335190a38d462373f197492ce3e9c3ca diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7937fb3..0000000 @@ -127,8 +127,8 @@ index 7937fb3..0000000 -*.draft ``` ``` -$ rad patch review --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b --no-announce -✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept --hunk 1 09f4d8b2335190a38d462373f197492ce3e9c3ca --no-announce +✓ Loaded existing review ([..]) for patch 09f4d8b2335190a38d462373f197492ce3e9c3ca 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 patch review --patch --accept -U3 --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b --no-announce -✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept -U3 --hunk 1 09f4d8b2335190a38d462373f197492ce3e9c3ca --no-announce +✓ Loaded existing review ([..]) for patch 09f4d8b2335190a38d462373f197492ce3e9c3ca diff --git a/MENU.txt b/MENU.txt index 867958c..3af9741 100644 --- a/MENU.txt @@ -153,8 +153,8 @@ index 867958c..3af9741 100644 [..] ``` ``` -$ rad patch review --patch --accept -U3 --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b --no-announce -✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept -U3 --hunk 1 09f4d8b2335190a38d462373f197492ce3e9c3ca --no-announce +✓ Loaded existing review ([..]) for patch 09f4d8b2335190a38d462373f197492ce3e9c3ca diff --git a/MENU.txt b/MENU.txt index 4e2e828..3af9741 100644 --- a/MENU.txt @@ -169,8 +169,8 @@ index 4e2e828..3af9741 100644 ``` ``` -$ rad patch review --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b --no-announce -✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept --hunk 1 09f4d8b2335190a38d462373f197492ce3e9c3ca --no-announce +✓ Loaded existing review ([..]) for patch 09f4d8b2335190a38d462373f197492ce3e9c3ca 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 patch review --patch --accept --hunk 1 52da8356aa9beec08e6943cb3c4063fa37f3241b --no-announce -✓ Loaded existing review ([..]) for patch 52da8356aa9beec08e6943cb3c4063fa37f3241b +$ rad patch review --patch --accept --hunk 1 09f4d8b2335190a38d462373f197492ce3e9c3ca --no-announce +✓ Loaded existing review ([..]) for patch 09f4d8b2335190a38d462373f197492ce3e9c3ca ✓ All hunks have been reviewed ``` diff --git a/radicle-cli/examples/workflow/4-patching-contributor.md b/radicle-cli/examples/workflow/4-patching-contributor.md index a2dcd6b4..a6ff3d54 100644 --- a/radicle-cli/examples/workflow/4-patching-contributor.md +++ b/radicle-cli/examples/workflow/4-patching-contributor.md @@ -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 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c opened +✓ Patch a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 opened To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk * [new reference] HEAD -> refs/patches ``` @@ -38,12 +38,12 @@ $ rad patch ╭────────────────────────────────────────────────────────────────────────────────╮ │ ● ID Title Author Head + - Updated │ ├────────────────────────────────────────────────────────────────────────────────┤ -│ ● 3581e83 Define power requirements bob (you) 3e674d1 +0 -0 now │ +│ ● a99d55e Define power requirements bob (you) 3e674d1 +0 -0 now │ ╰────────────────────────────────────────────────────────────────────────────────╯ -$ rad patch show 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c +$ rad patch show a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 ╭────────────────────────────────────────────────────╮ │ Title Define power requirements │ -│ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c │ +│ Patch a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 │ │ 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/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c +3e674d1a1df90807e934f9ae5da2591dd6848a33 refs/heads/patches/a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 ``` Wait, let's add a README too! Just for fun. @@ -77,15 +77,15 @@ $ 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 3581e83 updated to revision 6de8527cdf51f96e12649c7278efe1dccfdee885 +✓ Patch a99d55e updated to revision 25e7d77ed913ca07d06253988b73f392071d213d To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk - 3e674d1..27857ec flux-capacitor-power -> patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c + 3e674d1..27857ec flux-capacitor-power -> patches/a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 ``` And let's leave a quick comment for our team: ``` -$ rad patch comment 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c --message 'I cannot wait to get back to the 90s!' -q -b6711a58b45323f3ef2bb87cfb2b3b4d04c22a8b +$ rad patch comment a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 --message 'I cannot wait to get back to the 90s!' -q +8808e8b1d86dc51f5ed5c8b518df197e2c8f2fad ✓ Synced with 1 node(s) ``` diff --git a/radicle-cli/examples/workflow/5-patching-maintainer.md b/radicle-cli/examples/workflow/5-patching-maintainer.md index 4f985677..b28671a2 100644 --- a/radicle-cli/examples/workflow/5-patching-maintainer.md +++ b/radicle-cli/examples/workflow/5-patching-maintainer.md @@ -17,12 +17,12 @@ The contributor's changes are now visible to us. ``` $ git branch -r - bob/patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c + bob/patches/a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 rad/master -$ rad patch show 3581e83 +$ rad patch show a99d55e ╭─────────────────────────────────────────────────────────────────────╮ │ Title Define power requirements │ -│ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c │ +│ Patch a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 │ │ Author bob z6Mkt67…v4N1tRk │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ │ Commits ahead 2, behind 0 │ @@ -34,7 +34,7 @@ $ rad patch show 3581e83 │ 3e674d1 Define power requirements │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by bob z6Mkt67…v4N1tRk (3e674d1) now │ -│ ↑ updated to 6de8527cdf51f96e12649c7278efe1dccfdee885 (27857ec) now │ +│ ↑ updated to 25e7d77ed913ca07d06253988b73f392071d213d (27857ec) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` @@ -44,31 +44,31 @@ way will tell others about the corrections we needed before merging the changes. ``` -$ rad patch checkout 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c -✓ Switched to branch patch/3581e83 -✓ Branch patch/3581e83 setup to track rad/patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c +$ rad patch checkout a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 +✓ Switched to branch patch/a99d55e +✓ Branch patch/a99d55e setup to track rad/patches/a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 $ git mv REQUIREMENTS REQUIREMENTS.md $ git commit -m "Use markdown for requirements" -[patch/3581e83 f567f69] Use markdown for requirements +[patch/a99d55e 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 3581e83 updated to revision abb0360eae315bbd460743381303567587ab0e08 +✓ Patch a99d55e updated to revision d094c1b78f004305b29dee6bd2fe32e2d6945438 To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi - * [new branch] patch/3581e83 -> patches/3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c + * [new branch] patch/a99d55e -> patches/a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 ``` Great, all fixed up, lets accept and merge the code. ``` -$ rad patch review 3581e83 --revision abb0360 --accept -✓ Patch 3581e83 accepted +$ rad patch review a99d55e --revision d094c1b --accept +✓ Patch a99d55e accepted ✓ Synced with 1 node(s) $ git checkout master Your branch is up to date with 'rad/master'. -$ git merge patch/3581e83 +$ git merge patch/a99d55e Updating f2de534..f567f69 Fast-forward README.md | 0 @@ -79,7 +79,7 @@ Fast-forward ``` ``` (stderr) $ git push rad master -✓ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c merged at revision abb0360 +✓ Patch a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 merged at revision d094c1b ✓ Canonical head updated to f567f695d25b4e8fb63b5f5ad2a584529826e908 ✓ Synced with 1 node(s) To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi @@ -89,10 +89,10 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE The patch is now merged and closed :). ``` -$ rad patch show 3581e83 +$ rad patch show a99d55e ╭─────────────────────────────────────────────────────────────────────╮ │ Title Define power requirements │ -│ Patch 3581e83ad18f5cdd806ab50fa11cfd5dd4e8ae1c │ +│ Patch a99d55e5958a8c52ff7efbc8ff000d9bbdac79c7 │ │ Author bob z6Mkt67…v4N1tRk │ │ Head 27857ec9eb04c69cacab516e8bf4b5fd36090f66 │ │ Commits ahead 0, behind 1 │ @@ -104,10 +104,10 @@ $ rad patch show 3581e83 │ 3e674d1 Define power requirements │ ├─────────────────────────────────────────────────────────────────────┤ │ ● opened by bob z6Mkt67…v4N1tRk (3e674d1) now │ -│ ↑ updated to 6de8527cdf51f96e12649c7278efe1dccfdee885 (27857ec) now │ -│ * revised by alice (you) in abb0360 (f567f69) now │ +│ ↑ updated to 25e7d77ed913ca07d06253988b73f392071d213d (27857ec) now │ +│ * revised by alice (you) in d094c1b (f567f69) now │ │ └─ ✓ accepted by alice (you) now │ -│ └─ ✓ merged by alice (you) at revision abb0360 (f567f69) now │ +│ └─ ✓ merged by alice (you) at revision d094c1b (f567f69) now │ ╰─────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/src/commands/cob.rs b/radicle-cli/src/commands/cob.rs index cc9e42d7..d2bef2f0 100644 --- a/radicle-cli/src/commands/cob.rs +++ b/radicle-cli/src/commands/cob.rs @@ -136,15 +136,18 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { ) .to_rfc2822(); - term::print(term::format::yellow(format!("commit {}", op.id))); + term::print(term::format::yellow(format!("commit {}", op.id))); if let Some(oid) = op.identity { - term::print(term::format::tertiary(format!("parent {oid}"))); + term::print(term::format::tertiary(format!("resource {oid}"))); } for parent in op.parents { - term::print(format!("parent {}", parent)); + term::print(format!("parent {}", parent)); } - term::print(format!("author {}", op.author)); - term::print(format!("date {}", time)); + for parent in op.related { + term::print(format!("rel {}", parent)); + } + term::print(format!("author {}", op.author)); + term::print(format!("date {}", time)); term::blank(); for action in op.actions { diff --git a/radicle-cob/src/backend/git/change.rs b/radicle-cob/src/backend/git/change.rs index 2d3d3686..b59565ca 100644 --- a/radicle-cob/src/backend/git/change.rs +++ b/radicle-cob/src/backend/git/change.rs @@ -13,6 +13,7 @@ use radicle_git_ext::commit::trailers::OwnedTrailer; use crate::change::store::Version; use crate::signatures; +use crate::trailers::CommitTrailer; use crate::{ change, change::{store, Contents, Entry, Timestamp}, @@ -77,6 +78,8 @@ pub mod error { ChangeNotSigned(Oid), #[error("the 'change' found at '{0}' has more than one signature")] TooManySignatures(Oid), + #[error("the 'change' found at '{0}' has more than one resource trailer")] + TooManyResources(Oid), #[error(transparent)] ResourceTrailer(#[from] super::trailers::error::InvalidResourceTrailer), #[error("non utf-8 characters in commit message")] @@ -95,7 +98,7 @@ impl change::Storage for git2::Repository { fn store( &self, resource: Option, - mut parents: Vec, + mut related: Vec, signer: &Signer, spec: store::Template, ) -> Result @@ -118,9 +121,9 @@ impl change::Storage for git2::Repository { ExtendedSignature::new(*key, sig) }; - // Make sure there are no duplicates in the parents list. - parents.dedup(); - parents.sort(); + // Make sure there are no duplicates in the related list. + related.sort(); + related.dedup(); let (id, timestamp) = write_commit( self, @@ -128,12 +131,14 @@ impl change::Storage for git2::Repository { // Commit to tips, extra parents and resource. tips.iter() .cloned() - .chain(parents.clone()) + .chain(related.clone()) .chain(resource) .map(git2::Oid::from), message, signature.clone(), - vec![], + related + .iter() + .map(|p| trailers::CommitTrailer::Related(**p).into()), tree, )?; @@ -142,7 +147,8 @@ impl change::Storage for git2::Repository { revision: revision.into(), signature, resource, - parents: tips.into_iter().chain(parents).collect(), + parents: tips, + related, manifest, contents, timestamp, @@ -160,11 +166,23 @@ impl change::Storage for git2::Repository { fn load(&self, id: Self::ObjectId) -> Result { let commit = Commit::read(self, id.into())?; let timestamp = git2::Time::from(commit.committer().time).seconds() as u64; - let resource = parse_resource_trailer(commit.trailers())?; + let trailers = parse_trailers(commit.trailers())?; + let (resources, related): (Vec<_>, Vec<_>) = trailers.iter().partition(|t| match t { + CommitTrailer::Resource(_) => true, + CommitTrailer::Related(_) => false, + }); + let mut resources = resources + .into_iter() + .map(|r| r.oid().into()) + .collect::>(); + let related = related + .into_iter() + .map(|r| r.oid().into()) + .collect::>(); let parents = commit .parents() .map(Oid::from) - .filter(|p| Some(*p) != resource) + .filter(|p| !resources.contains(p) && !related.contains(p)) .collect(); let mut signatures = Signatures::try_from(&commit)? .into_iter() @@ -175,6 +193,9 @@ impl change::Storage for git2::Repository { if !signatures.is_empty() { return Err(error::Load::TooManySignatures(id)); } + if resources.len() > 1 { + return Err(error::Load::TooManyResources(id)); + }; let tree = self.find_tree(commit.tree())?; let manifest = load_manifest(self, &tree)?; @@ -184,7 +205,8 @@ impl change::Storage for git2::Repository { id, revision: tree.id().into(), signature: ExtendedSignature::new(key, sig), - resource, + resource: resources.pop(), + related, parents, manifest, contents, @@ -193,19 +215,20 @@ impl change::Storage for git2::Repository { } } -fn parse_resource_trailer<'a>( +fn parse_trailers<'a>( trailers: impl Iterator, -) -> Result, error::Load> { +) -> Result, error::Load> { + let mut parsed = Vec::new(); for trailer in trailers { - match trailers::ResourceCommitTrailer::try_from(trailer) { + match trailers::CommitTrailer::try_from(trailer) { Err(trailers::error::InvalidResourceTrailer::WrongToken) => { continue; } Err(err) => return Err(err.into()), - Ok(resource) => return Ok(Some(resource.oid().into())), + Ok(t) => parsed.push(t), } } - Ok(None) + Ok(parsed) } fn load_manifest( @@ -260,7 +283,7 @@ fn write_commit( ) -> Result<(Oid, Timestamp), error::Create> { let trailers: Vec = trailers .into_iter() - .chain(resource.map(|r| trailers::ResourceCommitTrailer::from(r).into())) + .chain(resource.map(|r| trailers::CommitTrailer::Resource(r).into())) .collect(); let author = repo.signature()?; #[allow(unused_variables)] diff --git a/radicle-cob/src/change/store.rs b/radicle-cob/src/change/store.rs index 0b09912a..a5f71ad5 100644 --- a/radicle-cob/src/change/store.rs +++ b/radicle-cob/src/change/store.rs @@ -22,7 +22,7 @@ pub trait Storage { fn store( &self, resource: Option, - parents: Vec, + related: Vec, signer: &G, template: Template, ) -> Result, Self::StoreError> @@ -71,8 +71,10 @@ pub struct Entry { /// The parent resource that this change lives under. For example, /// this change could be for a patch of a project. pub resource: Option, - /// Other parents this change depends on. + /// Parent changes. pub parents: Vec, + /// Other parents this change depends on. + pub related: Vec, /// The manifest describing the type of object as well as the type /// of history for this entry. pub manifest: Manifest, diff --git a/radicle-cob/src/change_graph.rs b/radicle-cob/src/change_graph.rs index b8fe201e..94290259 100644 --- a/radicle-cob/src/change_graph.rs +++ b/radicle-cob/src/change_graph.rs @@ -50,9 +50,7 @@ impl ChangeGraph { match storage.load(reference.target.id) { Ok(change) => { - let new_edges = builder - .add_change(storage, reference.target.id, change) - .ok()?; + let new_edges = builder.add_change(reference.target.id, change); edges_to_process.extend(new_edges); } Err(e) => { @@ -76,7 +74,7 @@ impl ChangeGraph { ); match storage.load(parent_commit_id) { Ok(change) => { - let new_edges = builder.add_change(storage, parent_commit_id, change).ok()?; + let new_edges = builder.add_change(parent_commit_id, change); edges_to_process.extend(new_edges); builder.add_edge(child_commit_id, parent_commit_id); } @@ -158,32 +156,26 @@ impl Default for GraphBuilder { impl GraphBuilder { /// Add a change to the graph which we are building up, returning any edges /// corresponding to the parents of this node in the change graph - fn add_change( - &mut self, - storage: &S, - commit_id: Oid, - change: Entry, - ) -> Result, S::LoadError> - where - S: change::Storage, - { + fn add_change(&mut self, commit_id: Oid, change: Entry) -> Vec<(Oid, Oid)> { let resource = change.resource().copied(); + let parents = change.parents.clone(); if !self.graph.contains(&commit_id) { self.graph.node(commit_id, change); } - Ok(storage - .parents_of(&commit_id)? + parents .into_iter() .filter_map(move |parent| { - if Some(parent) != resource && !self.graph.has_dependency(&commit_id, &parent) { + debug_assert_ne!(Some(parent), resource); + + if !self.graph.has_dependency(&commit_id, &parent) { Some((parent, commit_id)) } else { None } }) - .collect::>()) + .collect() } fn add_edge(&mut self, child: Oid, parent: Oid) { diff --git a/radicle-cob/src/object/collaboration/create.rs b/radicle-cob/src/object/collaboration/create.rs index de8d725e..43f50aae 100644 --- a/radicle-cob/src/object/collaboration/create.rs +++ b/radicle-cob/src/object/collaboration/create.rs @@ -57,7 +57,7 @@ pub fn create( storage: &S, signer: &G, resource: Option, - parents: Vec, + related: Vec, identifier: &PublicKey, args: Create, ) -> Result, error::Create> @@ -69,7 +69,7 @@ where let type_name = args.type_name.clone(); let version = args.version; let init_change = storage - .store(resource, parents, signer, args.template()) + .store(resource, related, signer, args.template()) .map_err(error::Create::from)?; let object_id = init_change.id().into(); let object = T::init(&init_change, storage).map_err(error::Create::evaluate)?; diff --git a/radicle-cob/src/object/collaboration/list.rs b/radicle-cob/src/object/collaboration/list.rs index c5a2b7da..5f3a0cca 100644 --- a/radicle-cob/src/object/collaboration/list.rs +++ b/radicle-cob/src/object/collaboration/list.rs @@ -22,23 +22,23 @@ where let references = storage .types(typename) .map_err(|err| error::Retrieve::Refs { err: Box::new(err) })?; - log::trace!("loaded {} references", references.len()); + log::trace!(target: "cob", "Loaded {} references", references.len()); let mut result = Vec::new(); for (oid, tip_refs) in references { - log::trace!("loading object '{oid}'"); + log::trace!(target: "cob", "Loading object '{oid}'"); let loaded = ChangeGraph::load(storage, tip_refs.iter(), typename, &oid) .map(|graph| graph.evaluate(storage).map_err(error::Retrieve::evaluate)); match loaded { Some(Ok(obj)) => { - log::trace!("object '{oid}' found"); + log::trace!(target: "cob", "Object '{oid}' found"); result.push(obj); } Some(Err(e)) => { - log::trace!("object '{oid}' failed to load: {e}") + log::trace!(target: "cob", "Object '{oid}' failed to load: {e}") } None => { - log::trace!("object '{oid}' not found"); + log::trace!(target: "cob", "Object '{oid}' not found"); } } } diff --git a/radicle-cob/src/object/collaboration/update.rs b/radicle-cob/src/object/collaboration/update.rs index 7b00030c..c7254e2d 100644 --- a/radicle-cob/src/object/collaboration/update.rs +++ b/radicle-cob/src/object/collaboration/update.rs @@ -59,7 +59,7 @@ pub fn update( storage: &S, signer: &G, resource: Option, - parents: Vec, + related: Vec, identifier: &PublicKey, args: Update, ) -> Result, error::Update> @@ -88,7 +88,7 @@ where // Create a commit for this change, but don't update any references yet. let entry = storage.store( resource, - parents, + related, signer, change::Template { tips: object.history.tips().into_iter().collect(), diff --git a/radicle-cob/src/trailers.rs b/radicle-cob/src/trailers.rs index f9b056fa..dc7ef317 100644 --- a/radicle-cob/src/trailers.rs +++ b/radicle-cob/src/trailers.rs @@ -17,29 +17,40 @@ pub mod error { } } -pub struct ResourceCommitTrailer(git2::Oid); +/// Commit trailer for COB commits. +pub enum CommitTrailer { + /// Points to the owning resource. + Resource(git2::Oid), + /// Points to a related change. + Related(git2::Oid), +} -impl ResourceCommitTrailer { +impl CommitTrailer { pub fn oid(&self) -> git2::Oid { - self.0 + match self { + Self::Resource(oid) => *oid, + Self::Related(oid) => *oid, + } } } -impl TryFrom<&Trailer<'_>> for ResourceCommitTrailer { +impl TryFrom<&Trailer<'_>> for CommitTrailer { type Error = error::InvalidResourceTrailer; fn try_from(Trailer { value, token }: &Trailer<'_>) -> Result { let ext_oid = git_ext::Oid::try_from(value.as_ref()).map_err(|_| Self::Error::InvalidOid)?; if token.deref() == "Rad-Resource" { - Ok(ResourceCommitTrailer(ext_oid.into())) + Ok(CommitTrailer::Resource(ext_oid.into())) + } else if token.deref() == "Rad-Related" { + Ok(CommitTrailer::Related(ext_oid.into())) } else { Err(Self::Error::WrongToken) } } } -impl TryFrom<&OwnedTrailer> for ResourceCommitTrailer { +impl TryFrom<&OwnedTrailer> for CommitTrailer { type Error = error::InvalidResourceTrailer; fn try_from(trailer: &OwnedTrailer) -> Result { @@ -47,31 +58,31 @@ impl TryFrom<&OwnedTrailer> for ResourceCommitTrailer { } } -impl From for ResourceCommitTrailer { - fn from(oid: git2::Oid) -> Self { - Self(oid) - } -} - -impl From for Trailer<'_> { - fn from(containing: ResourceCommitTrailer) -> Self { - Trailer { - // SAFETY: "Rad-Resource" is a valid `Token`. - #[allow(clippy::unwrap_used)] - token: Token::try_from("Rad-Resource").unwrap(), - value: containing.0.to_string().into(), +impl From for Trailer<'_> { + fn from(t: CommitTrailer) -> Self { + match t { + CommitTrailer::Related(oid) => { + Trailer { + // SAFETY: "Rad-Related" is a valid `Token`. + #[allow(clippy::unwrap_used)] + token: Token::try_from("Rad-Related").unwrap(), + value: oid.to_string().into(), + } + } + CommitTrailer::Resource(oid) => { + Trailer { + // SAFETY: "Rad-Resource" is a valid `Token`. + #[allow(clippy::unwrap_used)] + token: Token::try_from("Rad-Resource").unwrap(), + value: oid.to_string().into(), + } + } } } } -impl From for OwnedTrailer { - fn from(containing: ResourceCommitTrailer) -> Self { +impl From for OwnedTrailer { + fn from(containing: CommitTrailer) -> Self { Trailer::from(containing).to_owned() } } - -impl From for ResourceCommitTrailer { - fn from(oid: git_ext::Oid) -> Self { - Self(oid.into()) - } -} diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index 16b05432..ac4677fe 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -2503,7 +2503,7 @@ mod routes { #[tokio::test] async fn test_projects_create_patches() { - const CREATED_PATCH_ID: &str = "e546f1784df29d0ffd424021ebae556cbd950993"; + const CREATED_PATCH_ID: &str = "e21d5b18f8d6c75cfa9c35186b821b1764cb1ab8"; let tmp = tempfile::tempdir().unwrap(); let ctx = contributor(tmp.path()); @@ -2806,7 +2806,7 @@ mod routes { "reviews": [], }, { - "id": "50d760ccbcfadddd81fe32bd94283cbfd80133fa", + "id": "46fc3974dac96255e73daf2e1169cd929e713064", "author": { "id": CONTRIBUTOR_DID, }, @@ -3353,7 +3353,7 @@ mod routes { "summary": "A small review", "comments": [ { - "id": "2ed1c517997d3f1a83c6830ebab069c6e2ee967e", + "id": "9aebcd3b27fabb1700427d8ee7b8958b9a50a8f8", "author": { "id": "did:key:z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8", }, diff --git a/radicle-httpd/src/test.rs b/radicle-httpd/src/test.rs index 744baf98..7579d9c7 100644 --- a/radicle-httpd/src/test.rs +++ b/radicle-httpd/src/test.rs @@ -39,7 +39,7 @@ 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_PATCH_ID: &str = "0867c6389ee073304da0854a83885f47b1d7f5ed"; +pub const CONTRIBUTOR_PATCH_ID: &str = "89ddf1bf50a6e98f41372e8d554b4ac8e37e7d36"; /// Create a new profile. pub fn profile(home: &Path, seed: [u8; 32]) -> radicle::Profile { diff --git a/radicle/src/cob/op.rs b/radicle/src/cob/op.rs index f93e3549..8350d357 100644 --- a/radicle/src/cob/op.rs +++ b/radicle/src/cob/op.rs @@ -38,6 +38,8 @@ pub struct Op { pub timestamp: Timestamp, /// Parent operations. pub parents: Vec, + /// Related objects. + pub related: Vec, /// Head of identity document committed to by this operation. pub identity: Option, /// Object manifest. @@ -71,6 +73,7 @@ impl Op { author, timestamp: timestamp.into(), parents: vec![], + related: vec![], identity, manifest, } @@ -97,7 +100,8 @@ impl From for Op> { id: *entry.id(), actions: entry.contents().clone(), author: *entry.author(), - parents: entry.parents.to_owned(), + parents: entry.parents, + related: entry.related, timestamp: Timestamp::from_secs(entry.timestamp), identity: entry.resource, manifest: entry.manifest.clone(), @@ -130,6 +134,7 @@ where author: *entry.author(), timestamp: Timestamp::from_secs(entry.timestamp), parents: entry.parents.to_owned(), + related: entry.related.to_owned(), identity, manifest, }; diff --git a/radicle/src/cob/store.rs b/radicle/src/cob/store.rs index 6696da9c..006c09c9 100644 --- a/radicle/src/cob/store.rs +++ b/radicle/src/cob/store.rs @@ -147,13 +147,13 @@ where signer: &G, ) -> Result, Error> { let actions = actions.into(); - let parents = actions.iter().flat_map(T::Action::parents).collect(); + let related = actions.iter().flat_map(T::Action::parents).collect(); let changes = actions.try_map(encoding::encode)?; let updated = cob::update( self.repo, signer, self.identity, - parents, + related, signer.public_key(), Update { object_id, diff --git a/radicle/src/cob/test.rs b/radicle/src/cob/test.rs index ec000a88..2cb72c96 100644 --- a/radicle/src/cob/test.rs +++ b/radicle/src/cob/test.rs @@ -78,6 +78,7 @@ where timestamp: time.as_secs(), revision, parents: vec![], + related: vec![], manifest, }; @@ -113,6 +114,7 @@ where timestamp: timestamp.as_secs(), revision, parents: vec![], + related: vec![], manifest, }; self.history.extend(change); @@ -181,12 +183,14 @@ impl Actor { let actions = NonEmpty::from_vec(actions).unwrap(); let manifest = Manifest::new(T::type_name().clone(), Version::default()); let parents = vec![]; + let related = vec![]; Op { id, actions, author, parents, + related, timestamp, identity, manifest,