upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/bin/ngit/sub_commands
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-25 14:37:17 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-25 14:37:17 +0100
commitd6faad17e814d252a72e3aca39a4b3898382bab9 (patch)
tree16a238703293fe0d9cce04fa83de2af4a88f5433 /src/bin/ngit/sub_commands
parent4f84dc460c3494286233afe9ca480d3b7c0186b1 (diff)
chore: bump rust-nostr v0.35
bump all rust-nostr packages
Diffstat (limited to 'src/bin/ngit/sub_commands')
-rw-r--r--src/bin/ngit/sub_commands/list.rs14
-rw-r--r--src/bin/ngit/sub_commands/pull.rs9
-rw-r--r--src/bin/ngit/sub_commands/push.rs11
-rw-r--r--src/bin/ngit/sub_commands/send.rs4
4 files changed, 16 insertions, 22 deletions
diff --git a/src/bin/ngit/sub_commands/list.rs b/src/bin/ngit/sub_commands/list.rs
index 0755e3b..351896a 100644
--- a/src/bin/ngit/sub_commands/list.rs
+++ b/src/bin/ngit/sub_commands/list.rs
@@ -52,7 +52,7 @@ pub async fn launch() -> Result<()> {
52 vec![ 52 vec![
53 nostr::Filter::default() 53 nostr::Filter::default()
54 .kinds(status_kinds().clone()) 54 .kinds(status_kinds().clone())
55 .events(proposals_and_revisions.iter().map(nostr::Event::id)), 55 .events(proposals_and_revisions.iter().map(|e| e.id)),
56 ], 56 ],
57 ) 57 )
58 .await?; 58 .await?;
@@ -76,15 +76,15 @@ pub async fn launch() -> Result<()> {
76 let status = if let Some(e) = statuses 76 let status = if let Some(e) = statuses
77 .iter() 77 .iter()
78 .filter(|e| { 78 .filter(|e| {
79 status_kinds().contains(&e.kind()) 79 status_kinds().contains(&e.kind)
80 && e.tags() 80 && e.tags
81 .iter() 81 .iter()
82 .any(|t| t.as_vec()[1].eq(&proposal.id.to_string())) 82 .any(|t| t.as_slice()[1].eq(&proposal.id.to_string()))
83 }) 83 })
84 .collect::<Vec<&nostr::Event>>() 84 .collect::<Vec<&nostr::Event>>()
85 .first() 85 .first()
86 { 86 {
87 e.kind() 87 e.kind
88 } else { 88 } else {
89 Kind::GitStatusOpen 89 Kind::GitStatusOpen
90 }; 90 };
@@ -184,7 +184,7 @@ pub async fn launch() -> Result<()> {
184 let commits_events: Vec<nostr::Event> = get_all_proposal_patch_events_from_cache( 184 let commits_events: Vec<nostr::Event> = get_all_proposal_patch_events_from_cache(
185 git_repo_path, 185 git_repo_path,
186 &repo_ref, 186 &repo_ref,
187 &proposals_for_status[selected_index].id(), 187 &proposals_for_status[selected_index].id,
188 ) 188 )
189 .await?; 189 .await?;
190 190
@@ -704,7 +704,7 @@ fn save_patches_to_dir(mut patches: Vec<nostr::Event>, git_repo: &Repo) -> Resul
704 .truncate(true) 704 .truncate(true)
705 .open(path) 705 .open(path)
706 .context("open new patch file with write and truncate options")?; 706 .context("open new patch file with write and truncate options")?;
707 file.write_all(patch.content().as_bytes())?; 707 file.write_all(patch.content.as_bytes())?;
708 file.write_all("\n\n".as_bytes())?; 708 file.write_all("\n\n".as_bytes())?;
709 file.flush()?; 709 file.flush()?;
710 } 710 }
diff --git a/src/bin/ngit/sub_commands/pull.rs b/src/bin/ngit/sub_commands/pull.rs
index 9a3d911..d79b7b1 100644
--- a/src/bin/ngit/sub_commands/pull.rs
+++ b/src/bin/ngit/sub_commands/pull.rs
@@ -53,12 +53,9 @@ pub async fn launch() -> Result<()> {
53 .context("cannot find proposal that matches the current branch name")? 53 .context("cannot find proposal that matches the current branch name")?
54 .clone(); 54 .clone();
55 55
56 let commit_events = get_all_proposal_patch_events_from_cache( 56 let commit_events =
57 git_repo_path, 57 get_all_proposal_patch_events_from_cache(git_repo_path, &repo_ref, &proposal_root_event.id)
58 &repo_ref, 58 .await?;
59 &proposal_root_event.id(),
60 )
61 .await?;
62 59
63 let most_recent_proposal_patch_chain = 60 let most_recent_proposal_patch_chain =
64 get_most_recent_patch_with_ancestors(commit_events.clone()) 61 get_most_recent_patch_with_ancestors(commit_events.clone())
diff --git a/src/bin/ngit/sub_commands/push.rs b/src/bin/ngit/sub_commands/push.rs
index 66edfb4..a77f356 100644
--- a/src/bin/ngit/sub_commands/push.rs
+++ b/src/bin/ngit/sub_commands/push.rs
@@ -73,12 +73,9 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
73 .context("cannot find proposal that matches the current branch name")? 73 .context("cannot find proposal that matches the current branch name")?
74 .clone(); 74 .clone();
75 75
76 let commit_events = get_all_proposal_patch_events_from_cache( 76 let commit_events =
77 git_repo_path, 77 get_all_proposal_patch_events_from_cache(git_repo_path, &repo_ref, &proposal_root_event.id)
78 &repo_ref, 78 .await?;
79 &proposal_root_event.id(),
80 )
81 .await?;
82 79
83 let most_recent_proposal_patch_chain = get_most_recent_patch_with_ancestors(commit_events) 80 let most_recent_proposal_patch_chain = get_most_recent_patch_with_ancestors(commit_events)
84 .context("cannot get most recent patch for proposal")?; 81 .context("cannot get most recent patch for proposal")?;
@@ -191,7 +188,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
191 Some(proposal_root_event.id), 188 Some(proposal_root_event.id),
192 &signer, 189 &signer,
193 &repo_ref, 190 &repo_ref,
194 patch_events.last().map(nostr::Event::id), 191 patch_events.last().map(|e| e.id),
195 None, 192 None,
196 None, 193 None,
197 &None, 194 &None,
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs
index a807305..fe2952f 100644
--- a/src/bin/ngit/sub_commands/send.rs
+++ b/src/bin/ngit/sub_commands/send.rs
@@ -240,9 +240,9 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re
240 if root_proposal_id.is_none() { 240 if root_proposal_id.is_none() {
241 if let Some(event) = events.first() { 241 if let Some(event) = events.first() {
242 let event_bech32 = if let Some(relay) = repo_ref.relays.first() { 242 let event_bech32 = if let Some(relay) = repo_ref.relays.first() {
243 Nip19Event::new(event.id(), vec![relay]).to_bech32()? 243 Nip19Event::new(event.id, vec![relay]).to_bech32()?
244 } else { 244 } else {
245 event.id().to_bech32()? 245 event.id.to_bech32()?
246 }; 246 };
247 println!( 247 println!(
248 "{}", 248 "{}",