Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cob: Deduplicate change parents
Alexis Sellier committed 3 years ago
commit eecea67ffd1bf3ae16c3a85df274d1dca5a78421
parent 97f076e3cf36ac994742d3056f5e211744dcaa2c
5 files changed +19 -14
modified 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 c4ee2b105d8c43d090485b8997657cd3fc6af544
+
✓ Patch updated to revision b8f7bfbbb3c6a207b349e9f45bf535c706805871
```

And let's leave a quick comment for our team:

```
$ rad comment 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 --message 'I cannot wait to get back to the 90s!'
-
3b25dcd534ed80c2b1f8b432bae6b2b00d89dfb2
-
$ rad comment 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 --message 'I cannot wait to get back to the 90s!' --reply-to 3b25dcd534ed80c2b1f8b432bae6b2b00d89dfb2
-
f877693124903b7aab1d07f186f1a3ef95eb0c2a
+
16cb902f2657dc6ff9cf0f2c1a6ec4dc63340d23
+
$ rad comment 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 --message 'I cannot wait to get back to the 90s!' --reply-to 16cb902f2657dc6ff9cf0f2c1a6ec4dc63340d23
+
16363eca043df797de835fca477848ee37513084
```

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 c4ee2b105d8c43d090485b8997657cd3fc6af544 (27857ec) 3 months ago                         │
+
│ ↑ updated to b8f7bfbbb3c6a207b349e9f45bf535c706805871 (27857ec) 3 months ago                         │
│ ✓ accepted by z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) 3 months ago                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯
```
modified 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 916d20252a36be611ca21427f4abce2d6397833c
+
✓ Patch updated to revision 11483929d8714a92992229f65433e06288f3b760
```

And let's leave a quick comment for our team:

```
$ rad comment a07ef7743a32a2e902672ea3526d1db6ee08108a --message 'I cannot wait to get back to the 90s!'
-
eacda4ec25edcb89655774d08173858f0c05464c
+
18987961eb5e5a8c7fb1fb58f514030d3ea69802
```
modified 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 916d20252a36be611ca21427f4abce2d6397833c (27857ec) 3 months ago      │
+
│ ↑ updated to 11483929d8714a92992229f65433e06288f3b760 (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 a382489b0a6945cfe82d5df39703b4515c57731d
+
✓ Patch updated to revision 0795d619232479e910f95bb9c873ee1ec305c43c
```

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 a382489b0a6945cfe82d5df39703b4515c57731d
+
$ rad merge 0795d619232479e910f95bb9c873ee1ec305c43c
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 916d20252a36be611ca21427f4abce2d6397833c (27857ec) 3 months ago                  │
-
│ ↑ updated to a382489b0a6945cfe82d5df39703b4515c57731d (f6484e0) 3 months ago                  │
+
│ ↑ updated to 11483929d8714a92992229f65433e06288f3b760 (27857ec) 3 months ago                  │
+
│ ↑ updated to 0795d619232479e910f95bb9c873ee1ec305c43c (f6484e0) 3 months ago                  │
│ ✓ merged by did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (you) 3 months ago       │
╰───────────────────────────────────────────────────────────────────────────────────────────────╯
```
modified radicle-cob/src/backend/git/change.rs
@@ -249,10 +249,15 @@ where
    O: AsRef<git2::Oid>,
{
    let resource = *resource.as_ref();
+
    // Add extra parents ensuring there are no duplicates.
+
    let mut parents = parents.iter().map(|o| *o.as_ref()).collect::<Vec<_>>();
+
    parents.sort();
+
    parents.dedup();
+

    let parents = tips
        .iter()
-
        .chain(parents.iter())
        .map(|o| *o.as_ref())
+
        .chain(parents.into_iter())
        .chain(std::iter::once(resource))
        .collect::<Vec<_>>();

modified radicle-httpd/src/api/v1/projects.rs
@@ -1953,7 +1953,7 @@ mod routes {
                  "reviews": [],
                },
                {
-
                  "id": "69cfd3fc589782afbcd47027c1172f8a55dd74c7",
+
                  "id": "b1a8c5b3e1686891808fcac0d795d0bad1e69709",
                  "description": "This is a new revision",
                  "base": PARENT,
                  "oid": HEAD,