cli: Allow merging patch drafts
This commit is contained in:
parent
1bb400c278
commit
79c1fb309e
|
|
@ -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
|
||||||
|
```
|
||||||
|
|
@ -666,6 +666,26 @@ fn rad_patch_via_push() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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]
|
#[test]
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
fn rad_review_by_hunk() {
|
fn rad_review_by_hunk() {
|
||||||
|
|
|
||||||
|
|
@ -540,7 +540,7 @@ fn patch_merge_all<G: Signer>(
|
||||||
// Skip patches that failed to load.
|
// Skip patches that failed to load.
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
if !patch.is_open() {
|
if !patch.is_open() && !patch.is_draft() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Later revisions are more likely to be merged, so we build the list backwards.
|
// Later revisions are more likely to be merged, so we build the list backwards.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue