upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2023-11-01 00:00:00 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2023-11-01 00:00:00 +0000
commit6672f54dc166d7447e5c799f1809ecbb3d9ec04c (patch)
tree26d56fc39ee10eccb9b9f5f7a91142c65c803f59 /src
parent57321aa9136293b24757a6695a5c92087af539ab (diff)
feat(prs-create) use r instead of t tag for refs
r tags are indexed by relays in they same way as t tags and are a more appropriate for referencing commits
Diffstat (limited to 'src')
-rw-r--r--src/sub_commands/prs/create.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/sub_commands/prs/create.rs b/src/sub_commands/prs/create.rs
index e85611f..655978e 100644
--- a/src/sub_commands/prs/create.rs
+++ b/src/sub_commands/prs/create.rs
@@ -298,6 +298,9 @@ mod tests_unique_and_duplicate {
298 } 298 }
299} 299}
300 300
301pub static PR_KIND: u64 = 318;
302pub static PATCH_KIND: u64 = 317;
303
301fn generate_pr_and_patch_events( 304fn generate_pr_and_patch_events(
302 title: &String, 305 title: &String,
303 description: &String, 306 description: &String,
@@ -311,9 +314,9 @@ fn generate_pr_and_patch_events(
311 .context("failed to get root commit of the repository")?; 314 .context("failed to get root commit of the repository")?;
312 315
313 let pr_event = EventBuilder::new( 316 let pr_event = EventBuilder::new(
314 nostr::event::Kind::Custom(318), 317 nostr::event::Kind::Custom(PR_KIND),
315 format!("{title}\r\n\r\n{description}"), 318 format!("{title}\r\n\r\n{description}"),
316 &[Tag::Hashtag(format!("r-{root_commit}"))], 319 &[Tag::Reference(format!("r-{root_commit}"))],
317 // TODO: suggested branch name 320 // TODO: suggested branch name
318 // Tag::Generic( 321 // Tag::Generic(
319 // TagKind::Custom("suggested-branch-name".to_string()), 322 // TagKind::Custom("suggested-branch-name".to_string()),
@@ -335,14 +338,14 @@ fn generate_pr_and_patch_events(
335 .context("failed to create patch event")?; 338 .context("failed to create patch event")?;
336 events.push( 339 events.push(
337 EventBuilder::new( 340 EventBuilder::new(
338 nostr::event::Kind::Custom(317), 341 nostr::event::Kind::Custom(PATCH_KIND),
339 git_repo 342 git_repo
340 .make_patch_from_commit(commit) 343 .make_patch_from_commit(commit)
341 .context(format!("cannot make patch for commit {commit}"))?, 344 .context(format!("cannot make patch for commit {commit}"))?,
342 &[ 345 &[
343 Tag::Hashtag(format!("r-{root_commit}")), 346 Tag::Reference(format!("r-{root_commit}")),
344 Tag::Hashtag(commit.to_string()), 347 Tag::Reference(commit.to_string()),
345 Tag::Hashtag(commit_parent.to_string()), 348 Tag::Reference(commit_parent.to_string()),
346 Tag::Event( 349 Tag::Event(
347 pr_event_id, 350 pr_event_id,
348 None, // TODO: add relay 351 None, // TODO: add relay