Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Allow merging patch drafts
cloudhead committed 2 years ago
commit 79c1fb309e0a0e3cc350f4b548e7950e34663d8d
parent 1bb400c278f33402cf28bf3c09f849df69589a0a
3 files changed +40 -1
added radicle-cli/examples/rad-patch-merge-draft.md
@@ -0,0 +1,19 @@
+
Let's start by creating a draft patch.
+

+
``` (stderr) RAD_SOCKET=/dev/null
+
$ 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
+
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+
 * [new reference]   HEAD -> refs/patches
+
```
+

+
``` (stderr) RAD_SOCKET=/dev/null
+
$ git checkout master -q
+
$ git merge feature/1
+
$ git push rad master
+
✓ Patch cf29ac6b10141058be66b94a92a81c703b972751 merged
+
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+
   f2de534..20aa5dd  master -> master
+
```
modified radicle-cli/tests/commands.rs
@@ -667,6 +667,26 @@ fn rad_patch_via_push() {
}

#[test]
+
fn rad_patch_merge_draft() {
+
    let mut environment = Environment::new();
+
    let profile = environment.profile(config::profile("alice"));
+
    let working = tempfile::tempdir().unwrap();
+
    let home = &profile.home;
+

+
    // Setup a test repository.
+
    fixtures::repository(working.path());
+

+
    test("examples/rad-init.md", working.path(), Some(home), []).unwrap();
+
    test(
+
        "examples/rad-patch-merge-draft.md",
+
        working.path(),
+
        Some(home),
+
        [],
+
    )
+
    .unwrap();
+
}
+

+
#[test]
#[cfg(not(target_os = "macos"))]
fn rad_review_by_hunk() {
    let mut environment = Environment::new();
modified radicle-remote-helper/src/push.rs
@@ -540,7 +540,7 @@ fn patch_merge_all<G: Signer>(
            // Skip patches that failed to load.
            continue;
        };
-
        if !patch.is_open() {
+
        if !patch.is_open() && !patch.is_draft() {
            continue;
        }
        // Later revisions are more likely to be merged, so we build the list backwards.