diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-13 06:27:34 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-13 06:27:34 +0000 |
| commit | 3112576195aef212622d27ad9164336796c1953e (patch) | |
| tree | 0e897bcb8309c2d4c8f33d7c1590c2dcc0577508 /src/sub_commands/push.rs | |
| parent | 9cd3e43b899b23b7f6e75276fa3d19bf9550f8fd (diff) | |
feat(prs-create)!: pr to nip34-like cover letter
up the pr event type to a nip34-like cover letter format
this sets the building blocks in place to enable simplier clients to
use the 'cover letter' feature in `git format-patch` to create the
experience as a pr event
Diffstat (limited to 'src/sub_commands/push.rs')
| -rw-r--r-- | src/sub_commands/push.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sub_commands/push.rs b/src/sub_commands/push.rs index 037d512..61d5d46 100644 --- a/src/sub_commands/push.rs +++ b/src/sub_commands/push.rs | |||
| @@ -9,7 +9,7 @@ use crate::{ | |||
| 9 | client::Connect, | 9 | client::Connect, |
| 10 | git::{str_to_sha1, Repo, RepoActions}, | 10 | git::{str_to_sha1, Repo, RepoActions}, |
| 11 | login, | 11 | login, |
| 12 | repo_ref::{self, RepoRef}, | 12 | repo_ref::{self, RepoRef, REPO_REF_KIND}, |
| 13 | sub_commands::prs::{ | 13 | sub_commands::prs::{ |
| 14 | create::{generate_patch_event, send_events, PATCH_KIND, PR_KIND}, | 14 | create::{generate_patch_event, send_events, PATCH_KIND, PR_KIND}, |
| 15 | list::{get_most_recent_patch_with_ancestors, tag_value}, | 15 | list::{get_most_recent_patch_with_ancestors, tag_value}, |
| @@ -106,7 +106,7 @@ pub async fn launch(cli_args: &Cli) -> Result<()> { | |||
| 106 | &git_repo, | 106 | &git_repo, |
| 107 | &root_commit, | 107 | &root_commit, |
| 108 | commit, | 108 | commit, |
| 109 | pr_event.id, | 109 | Some(pr_event.id), |
| 110 | &keys, | 110 | &keys, |
| 111 | &repo_ref, | 111 | &repo_ref, |
| 112 | patch_events.last().map(nostr::Event::id), | 112 | patch_events.last().map(nostr::Event::id), |
| @@ -146,7 +146,12 @@ async fn fetch_pr_and_most_recent_patch_chain( | |||
| 146 | vec![ | 146 | vec![ |
| 147 | nostr::Filter::default() | 147 | nostr::Filter::default() |
| 148 | .kind(nostr::Kind::Custom(PR_KIND)) | 148 | .kind(nostr::Kind::Custom(PR_KIND)) |
| 149 | .reference(format!("r-{root_commit}")), | 149 | .identifiers( |
| 150 | repo_ref | ||
| 151 | .maintainers | ||
| 152 | .iter() | ||
| 153 | .map(|m| format!("{REPO_REF_KIND}:{m}:{}", repo_ref.identifier)), | ||
| 154 | ), | ||
| 150 | ], | 155 | ], |
| 151 | ) | 156 | ) |
| 152 | .await? | 157 | .await? |
| @@ -155,7 +160,7 @@ async fn fetch_pr_and_most_recent_patch_chain( | |||
| 155 | e.kind.as_u64() == PR_KIND | 160 | e.kind.as_u64() == PR_KIND |
| 156 | && e.tags | 161 | && e.tags |
| 157 | .iter() | 162 | .iter() |
| 158 | .any(|t| t.as_vec().len() > 1 && t.as_vec()[1].eq(&format!("r-{root_commit}"))) | 163 | .any(|t| t.as_vec().len() > 1 && t.as_vec()[1].eq(&format!("{root_commit}"))) |
| 159 | && tag_value(e, "branch-name") | 164 | && tag_value(e, "branch-name") |
| 160 | .unwrap_or_default() | 165 | .unwrap_or_default() |
| 161 | .eq(branch_name) | 166 | .eq(branch_name) |