diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-02 06:44:28 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-02 06:51:40 +0000 |
| commit | ccdbc337ae16d7c70be44166269c8b2d5b9f5c09 (patch) | |
| tree | 5cc6da88ef898e4376a25695b3b9c64ea30f84f7 /src/sub_commands/push.rs | |
| parent | 401e60b98d94bc1f51dbd4b6083e92642a36efda (diff) | |
feat(prs-create)!: use nip34 patch kind and tags
- change kind number
- remove "r-" prefix from unique commit id r tag
- rename tag commit-sig to commit-pgp-sig
- a tag for repo identifer and pubkey. this serves as a vote for
this pubkey being a maintainer
- add relay hints
- change format of committer tag
- remove r references to parent commit id
- tag parent patch event if its part of change request
author and commit-message tags still need to be removed but they are
required to apply patches with gitlib2. we will need to fallback to
running the git client to apply patches.
BREAKING CHANGE: change patch/commit event kind and tags to reflect
nip34 draft. events with the older kind will no longer be found and
will not be in a valid format
Diffstat (limited to 'src/sub_commands/push.rs')
| -rw-r--r-- | src/sub_commands/push.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/sub_commands/push.rs b/src/sub_commands/push.rs index e592cd7..fac746f 100644 --- a/src/sub_commands/push.rs +++ b/src/sub_commands/push.rs | |||
| @@ -102,8 +102,16 @@ pub async fn launch(cli_args: &Cli) -> Result<()> { | |||
| 102 | let mut patch_events: Vec<nostr::Event> = vec![]; | 102 | let mut patch_events: Vec<nostr::Event> = vec![]; |
| 103 | for commit in &ahead { | 103 | for commit in &ahead { |
| 104 | patch_events.push( | 104 | patch_events.push( |
| 105 | generate_patch_event(&git_repo, &root_commit, commit, pr_event.id, &keys) | 105 | generate_patch_event( |
| 106 | .context("cannot make patch event from commit")?, | 106 | &git_repo, |
| 107 | &root_commit, | ||
| 108 | commit, | ||
| 109 | pr_event.id, | ||
| 110 | &keys, | ||
| 111 | &repo_ref, | ||
| 112 | patch_events.last().map(nostr::Event::id), | ||
| 113 | ) | ||
| 114 | .context("cannot make patch event from commit")?, | ||
| 107 | ); | 115 | ); |
| 108 | } | 116 | } |
| 109 | println!("pushing {} commits", ahead.len()); | 117 | println!("pushing {} commits", ahead.len()); |
| @@ -162,8 +170,7 @@ async fn fetch_pr_and_most_recent_patch_chain( | |||
| 162 | vec![ | 170 | vec![ |
| 163 | nostr::Filter::default() | 171 | nostr::Filter::default() |
| 164 | .kind(nostr::Kind::Custom(PATCH_KIND)) | 172 | .kind(nostr::Kind::Custom(PATCH_KIND)) |
| 165 | .event(pr_event.id) | 173 | .event(pr_event.id), |
| 166 | .reference(format!("r-{root_commit}")), | ||
| 167 | ], | 174 | ], |
| 168 | ) | 175 | ) |
| 169 | .await? | 176 | .await? |
| @@ -173,9 +180,6 @@ async fn fetch_pr_and_most_recent_patch_chain( | |||
| 173 | && e.tags | 180 | && e.tags |
| 174 | .iter() | 181 | .iter() |
| 175 | .any(|t| t.as_vec().len() > 2 && t.as_vec()[1].eq(&pr_event.id.to_string())) | 182 | .any(|t| t.as_vec().len() > 2 && t.as_vec()[1].eq(&pr_event.id.to_string())) |
| 176 | && e.tags | ||
| 177 | .iter() | ||
| 178 | .any(|t| t.as_vec().len() > 1 && t.as_vec()[1].eq(&format!("r-{root_commit}"))) | ||
| 179 | }) | 183 | }) |
| 180 | .map(std::borrow::ToOwned::to_owned) | 184 | .map(std::borrow::ToOwned::to_owned) |
| 181 | .collect(); | 185 | .collect(); |