diff --git a/radicle-cli/examples/rad-id-rebase.md b/radicle-cli/examples/rad-id-rebase.md index bb0f7684..c15ea064 100644 --- a/radicle-cli/examples/rad-id-rebase.md +++ b/radicle-cli/examples/rad-id-rebase.md @@ -250,7 +250,7 @@ So, let's fix this by running a rebase on the proposal's revision: ``` $ rad id rebase 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --no-confirm βœ“ Identity proposal '3f6ae4f8645c8b0cbcd35ea924df7b13aca52774' rebased 🌱 -βœ“ Revision '42b9428df59ad349f706b1397750b75ea3b42574' +βœ“ Revision 'a6db848f8dba4ef2a9c16301e7d21ad87b707f1e' title: Add Bob description: Add Bob as a delegate status: ❲open❳ @@ -293,9 +293,9 @@ Quorum Reached We can now update the proposal to have both keys in the delegates set: ``` -$ rad id update 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --rev 42b9428df59ad349f706b1397750b75ea3b42574 --delegates did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn --no-confirm +$ rad id update 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --rev a6db848f8dba4ef2a9c16301e7d21ad87b707f1e --delegates did:key:z6MkedTZGJGqgQ2py2b8kGecfxdt2yRdHWF6JpaZC47fovFn --no-confirm βœ“ Identity proposal '3f6ae4f8645c8b0cbcd35ea924df7b13aca52774' updated 🌱 -βœ“ Revision '1b4ded759249e4f76d19c3e580b4736bf2a2d1c4' +βœ“ Revision '4bac5e3ef20e412e9421886fbb76dc7a64d6b5dc' title: Add Bob description: Add Bob as a delegate status: ❲open❳ @@ -341,7 +341,7 @@ state of our new Radicle identity: $ rad id show 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --revisions ``` -$ rad id accept 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --rev 1b4ded759249e4f76d19c3e580b4736bf2a2d1c4 --no-confirm +$ rad id accept 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --rev 4bac5e3ef20e412e9421886fbb76dc7a64d6b5dc --no-confirm βœ“ Accepted proposal βœ“ title: Add Bob description: Add Bob as a delegate @@ -385,7 +385,7 @@ Quorum Reached ``` ``` -$ rad id commit 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --rev 1b4ded759249e4f76d19c3e580b4736bf2a2d1c4 --no-confirm +$ rad id commit 3f6ae4f8645c8b0cbcd35ea924df7b13aca52774 --rev 4bac5e3ef20e412e9421886fbb76dc7a64d6b5dc --no-confirm βœ“ Committed new identity '60de897bc24898f6908fd1272633c0b15aa4096f' 🌱 title: Add Bob description: Add Bob as a delegate diff --git a/radicle-cli/examples/rad-patch.md b/radicle-cli/examples/rad-patch.md index a7f236c2..da02acad 100644 --- a/radicle-cli/examples/rad-patch.md +++ b/radicle-cli/examples/rad-patch.md @@ -84,16 +84,16 @@ $ git commit --message "Add README, just for the fun" $ rad patch update --message "Add README, just for the fun" 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 Updating 3e674d1 -> 27857ec 1 commit(s) ahead, 0 commit(s) behind -βœ“ Patch updated to revision 56a5efc062b34a97a162a3a4d4468ce3e7ba1c84 +βœ“ Patch updated to revision c4ee2b105d8c43d090485b8997657cd3fc6af544 ``` And let's leave a quick comment for our team: ``` $ rad comment 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 --message 'I cannot wait to get back to the 90s!' -70fc8b18300096f6f0f919797457244e6e4b2cea -$ rad comment 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 --message 'I cannot wait to get back to the 90s!' --reply-to 70fc8b18300096f6f0f919797457244e6e4b2cea -7a9f7a6358238f4ff115d2b2a5e522ab93867d38 +3b25dcd534ed80c2b1f8b432bae6b2b00d89dfb2 +$ rad comment 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 --message 'I cannot wait to get back to the 90s!' --reply-to 3b25dcd534ed80c2b1f8b432bae6b2b00d89dfb2 +f877693124903b7aab1d07f186f1a3ef95eb0c2a ``` Now, let's checkout the patch that we just created: @@ -118,7 +118,7 @@ $ rad patch β”‚ Define power requirements 191a14e R1 27857ec (flux-capacitor-power, patch/191a14e) ahead 2, behind 0 β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ ● opened by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) 3 months ago β”‚ -β”‚ ↑ updated to 56a5efc062b34a97a162a3a4d4468ce3e7ba1c84 (27857ec) 3 months ago β”‚ +β”‚ ↑ updated to c4ee2b105d8c43d090485b8997657cd3fc6af544 (27857ec) 3 months ago β”‚ β”‚ βœ“ accepted by z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) 3 months ago β”‚ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cli/examples/workflow/4-patching-contributor.md b/radicle-cli/examples/workflow/4-patching-contributor.md index 1ff7fe5e..b2be8f8d 100644 --- a/radicle-cli/examples/workflow/4-patching-contributor.md +++ b/radicle-cli/examples/workflow/4-patching-contributor.md @@ -82,12 +82,12 @@ $ git commit --message "Add README, just for the fun" $ rad patch update --message "Add README, just for the fun" a07ef7743a32a2e902672ea3526d1db6ee08108a Updating 3e674d1 -> 27857ec 1 commit(s) ahead, 0 commit(s) behind -βœ“ Patch updated to revision 4f15eb5c994edd0bb6be29cb4801aa74308cc628 +βœ“ Patch updated to revision 916d20252a36be611ca21427f4abce2d6397833c ``` And let's leave a quick comment for our team: ``` $ rad comment a07ef7743a32a2e902672ea3526d1db6ee08108a --message 'I cannot wait to get back to the 90s!' -73b006df6f494e6fb9f9b9e8ad152091fc25db69 +eacda4ec25edcb89655774d08173858f0c05464c ``` diff --git a/radicle-cli/examples/workflow/5-patching-maintainer.md b/radicle-cli/examples/workflow/5-patching-maintainer.md index 03a0c7aa..ca1de09f 100644 --- a/radicle-cli/examples/workflow/5-patching-maintainer.md +++ b/radicle-cli/examples/workflow/5-patching-maintainer.md @@ -31,7 +31,7 @@ $ rad patch β”‚ Define power requirements a07ef77 R1 27857ec ahead 2, behind 0 β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ ● opened by did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk 3 months ago β”‚ -β”‚ ↑ updated to 4f15eb5c994edd0bb6be29cb4801aa74308cc628 (27857ec) 3 months ago β”‚ +β”‚ ↑ updated to 916d20252a36be611ca21427f4abce2d6397833c (27857ec) 3 months ago β”‚ ╰───────────────────────────────────────────────────────────────────────────────────╯ ``` @@ -51,7 +51,7 @@ $ git commit --fixup HEAD~ $ rad patch update --message "Define power requirements" --message "See details." a07ef7743a32a2e902672ea3526d1db6ee08108a Updating 27857ec -> f6484e0 1 commit(s) ahead, 0 commit(s) behind -βœ“ Patch updated to revision 737dc47d9eba730c5db8a8e33c41c7955f9093de +βœ“ Patch updated to revision a382489b0a6945cfe82d5df39703b4515c57731d ``` Great, all fixed up, lets merge the code. @@ -59,7 +59,7 @@ Great, all fixed up, lets merge the code. ``` $ git checkout master Your branch is up to date with 'rad/master'. -$ rad merge 737dc47d9eba730c5db8a8e33c41c7955f9093de +$ rad merge a382489b0a6945cfe82d5df39703b4515c57731d Merging a07ef77 R2 (f6484e0) by z6Mkt67…v4N1tRk into master (f2de534) via fast-forward... Running `git merge --ff-only f6484e0f43e48a8983b9b39bf9bd4cd889f1d520`... Updating f2de534..f6484e0 @@ -81,8 +81,8 @@ $ rad patch --merged β”‚ Define power requirements a07ef77 R2 f6484e0 (flux-capacitor-power, master) ahead 3, behind 0 β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ ● opened by did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk 3 months ago β”‚ -β”‚ ↑ updated to 4f15eb5c994edd0bb6be29cb4801aa74308cc628 (27857ec) 3 months ago β”‚ -β”‚ ↑ updated to 737dc47d9eba730c5db8a8e33c41c7955f9093de (f6484e0) 3 months ago β”‚ +β”‚ ↑ updated to 916d20252a36be611ca21427f4abce2d6397833c (27857ec) 3 months ago β”‚ +β”‚ ↑ updated to a382489b0a6945cfe82d5df39703b4515c57731d (f6484e0) 3 months ago β”‚ β”‚ βœ“ merged by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) 3 months ago β”‚ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ``` diff --git a/radicle-cob/src/backend/git/change.rs b/radicle-cob/src/backend/git/change.rs index 6cdbe84a..418aebda 100644 --- a/radicle-cob/src/backend/git/change.rs +++ b/radicle-cob/src/backend/git/change.rs @@ -119,7 +119,15 @@ impl change::Storage for git2::Repository { ExtendedSignature::new(*key, sig) }; - let (id, timestamp) = write_commit(self, resource, tips, message, signature.clone(), tree)?; + let (id, timestamp) = write_commit( + self, + resource, + parents.clone(), + tips, + message, + signature.clone(), + tree, + )?; Ok(Change { id, revision: revision.into(), @@ -231,6 +239,7 @@ fn load_contents( fn write_commit( repo: &git2::Repository, resource: O, + parents: Vec, tips: Vec, message: String, signature: ExtendedSignature, @@ -242,6 +251,7 @@ where let resource = *resource.as_ref(); let parents = tips .iter() + .chain(parents.iter()) .map(|o| *o.as_ref()) .chain(std::iter::once(resource)) .collect::>(); diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index 5d8903fe..9e9c2913 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -1953,7 +1953,7 @@ mod routes { "reviews": [], }, { - "id": "bdc0364b51a3346653a795b73332eb792283be37", + "id": "69cfd3fc589782afbcd47027c1172f8a55dd74c7", "description": "This is a new revision", "base": PARENT, "oid": HEAD, diff --git a/radicle/src/cob/identity.rs b/radicle/src/cob/identity.rs index 9439677b..72e1daf5 100644 --- a/radicle/src/cob/identity.rs +++ b/radicle/src/cob/identity.rs @@ -68,7 +68,16 @@ pub enum Action { }, } -impl HistoryAction for Action {} +impl HistoryAction for Action { + fn parents(&self) -> Vec { + match self { + Self::Revision { current, .. } => { + vec![*current] + } + _ => vec![], + } + } +} /// Error applying an operation onto a state. #[derive(Error, Debug)] diff --git a/radicle/src/cob/patch.rs b/radicle/src/cob/patch.rs index 4901a9a3..2c90e39e 100644 --- a/radicle/src/cob/patch.rs +++ b/radicle/src/cob/patch.rs @@ -119,7 +119,19 @@ pub enum Action { }, } -impl HistoryAction for Action {} +impl HistoryAction for Action { + fn parents(&self) -> Vec { + match self { + Self::Revision { base, oid, .. } => { + vec![*base, *oid] + } + Self::Merge { commit, .. } => { + vec![*commit] + } + _ => vec![], + } + } +} /// Where a patch is intended to be merged. #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]