From ccdbc337ae16d7c70be44166269c8b2d5b9f5c09 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 2 Feb 2024 06:44:28 +0000 Subject: 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 --- src/sub_commands/push.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/sub_commands/push.rs') 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<()> { let mut patch_events: Vec = vec![]; for commit in &ahead { patch_events.push( - generate_patch_event(&git_repo, &root_commit, commit, pr_event.id, &keys) - .context("cannot make patch event from commit")?, + generate_patch_event( + &git_repo, + &root_commit, + commit, + pr_event.id, + &keys, + &repo_ref, + patch_events.last().map(nostr::Event::id), + ) + .context("cannot make patch event from commit")?, ); } println!("pushing {} commits", ahead.len()); @@ -162,8 +170,7 @@ async fn fetch_pr_and_most_recent_patch_chain( vec![ nostr::Filter::default() .kind(nostr::Kind::Custom(PATCH_KIND)) - .event(pr_event.id) - .reference(format!("r-{root_commit}")), + .event(pr_event.id), ], ) .await? @@ -173,9 +180,6 @@ async fn fetch_pr_and_most_recent_patch_chain( && e.tags .iter() .any(|t| t.as_vec().len() > 2 && t.as_vec()[1].eq(&pr_event.id.to_string())) - && e.tags - .iter() - .any(|t| t.as_vec().len() > 1 && t.as_vec()[1].eq(&format!("r-{root_commit}"))) }) .map(std::borrow::ToOwned::to_owned) .collect(); -- cgit v1.2.3