From 33461e4be19d750852dd9c7bd49c1db849d228a4 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 3 Apr 2023 13:33:43 +0200 Subject: [PATCH] Set patch status to `merged` automatically When a merge is applied to a patch, we check whether the threshold of delegates has been reached, at which point we set the patch status to `merged`. This requires threading the identity document oid through the "apply" process. --- .../workflow/5-patching-maintainer.md | 2 +- radicle-cli/src/commands/patch.rs | 37 +++++++-- radicle-cli/src/commands/patch/list.rs | 13 +++- radicle-httpd/src/api/v1/delegates.rs | 1 + radicle-httpd/src/api/v1/projects.rs | 4 +- radicle/src/cob/identity.rs | 20 +++-- radicle/src/cob/issue.rs | 28 ++++--- radicle/src/cob/op.rs | 8 ++ radicle/src/cob/patch.rs | 75 ++++++++++++++----- radicle/src/cob/store.rs | 31 +++++--- radicle/src/cob/test.rs | 2 + radicle/src/cob/thread.rs | 51 +++++++++---- radicle/src/identity/doc.rs | 8 ++ radicle/src/storage.rs | 10 ++- radicle/src/storage/git.rs | 9 +-- radicle/src/test/arbitrary.rs | 11 ++- radicle/src/test/storage.rs | 19 ++++- 17 files changed, 248 insertions(+), 81 deletions(-) diff --git a/radicle-cli/examples/workflow/5-patching-maintainer.md b/radicle-cli/examples/workflow/5-patching-maintainer.md index 581179be..03a0c7aa 100644 --- a/radicle-cli/examples/workflow/5-patching-maintainer.md +++ b/radicle-cli/examples/workflow/5-patching-maintainer.md @@ -76,7 +76,7 @@ Fast-forward The patch is now merged and closed :). ``` -$ rad patch +$ rad patch --merged ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │ Define power requirements a07ef77 R2 f6484e0 (flux-capacitor-power, master) ahead 3, behind 0 │ ├───────────────────────────────────────────────────────────────────────────────────────────────┤ diff --git a/radicle-cli/src/commands/patch.rs b/radicle-cli/src/commands/patch.rs index 80f10400..937996e8 100644 --- a/radicle-cli/src/commands/patch.rs +++ b/radicle-cli/src/commands/patch.rs @@ -17,6 +17,7 @@ use std::ffi::OsString; use anyhow::anyhow; +use radicle::cob::patch; use radicle::cob::patch::PatchId; use radicle::{prelude::*, Node}; @@ -34,7 +35,7 @@ pub const HELP: Help = Help { Usage rad patch - rad patch list + rad patch list [--all|--merged|--open|--archived] rad patch show rad patch open [