diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-16 11:01:44 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-07-16 11:01:44 +0100 |
| commit | 7704178c618f8ac455cd6b0582edb511a9e644c3 (patch) | |
| tree | 775e425f0af2543eb12e4a4b1d4feb022611368f /src/bin | |
| parent | 8cea674f58e806c22d2887cff5e6f76bc4dba0db (diff) | |
| parent | ac53bca7e315848864ff9e51703720b5b466bc42 (diff) | |
Merge branch 'upgrade-dependancies'
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 36 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/utils.rs | 13 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/list.rs | 13 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/send.rs | 7 |
4 files changed, 43 insertions, 26 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 04fc4d8..9ff8af0 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -1049,10 +1049,13 @@ async fn get_merged_status_events( | |||
| 1049 | let (ahead, _) = | 1049 | let (ahead, _) = |
| 1050 | git_repo.get_commits_ahead_behind(&tip_of_remote_branch, &tip_of_pushed_branch)?; | 1050 | git_repo.get_commits_ahead_behind(&tip_of_remote_branch, &tip_of_pushed_branch)?; |
| 1051 | 1051 | ||
| 1052 | let commit_events = get_events_from_local_cache(git_repo.get_path()?, vec![ | 1052 | let commit_events = get_events_from_local_cache( |
| 1053 | nostr::Filter::default().kind(nostr::Kind::GitPatch), | 1053 | git_repo.get_path()?, |
| 1054 | // TODO: limit by repo_ref | 1054 | vec![ |
| 1055 | ]) | 1055 | nostr::Filter::default().kind(nostr::Kind::GitPatch), |
| 1056 | // TODO: limit by repo_ref | ||
| 1057 | ], | ||
| 1058 | ) | ||
| 1056 | .await?; | 1059 | .await?; |
| 1057 | 1060 | ||
| 1058 | let merged_proposals_info = | 1061 | let merged_proposals_info = |
| @@ -1129,9 +1132,12 @@ async fn get_merged_proposals_info( | |||
| 1129 | proposals.entry(proposal_id).or_default(); | 1132 | proposals.entry(proposal_id).or_default(); |
| 1130 | // ignore revisions without all the merged commits | 1133 | // ignore revisions without all the merged commits |
| 1131 | if entry_revision_id == &revision_id { | 1134 | if entry_revision_id == &revision_id { |
| 1132 | merged_patches.insert(*commit_hash, MergedPRCommitType::PatchCommit { | 1135 | merged_patches.insert( |
| 1133 | event_id: patch_event.id, | 1136 | *commit_hash, |
| 1134 | }); | 1137 | MergedPRCommitType::PatchCommit { |
| 1138 | event_id: patch_event.id, | ||
| 1139 | }, | ||
| 1140 | ); | ||
| 1135 | } | 1141 | } |
| 1136 | } | 1142 | } |
| 1137 | } | 1143 | } |
| @@ -1156,9 +1162,12 @@ async fn get_merged_proposals_info( | |||
| 1156 | proposals.entry(proposal_id).or_default(); | 1162 | proposals.entry(proposal_id).or_default(); |
| 1157 | // ignore revisions without all the applied commits | 1163 | // ignore revisions without all the applied commits |
| 1158 | if entry_revision_id == &revision_id { | 1164 | if entry_revision_id == &revision_id { |
| 1159 | merged_patches.insert(*commit_hash, MergedPRCommitType::PatchApplied { | 1165 | merged_patches.insert( |
| 1160 | event_id: patch_event.id, | 1166 | *commit_hash, |
| 1161 | }); | 1167 | MergedPRCommitType::PatchApplied { |
| 1168 | event_id: patch_event.id, | ||
| 1169 | }, | ||
| 1170 | ); | ||
| 1162 | } | 1171 | } |
| 1163 | } | 1172 | } |
| 1164 | } | 1173 | } |
| @@ -1405,9 +1414,10 @@ async fn get_proposal_and_revision_root_from_patch( | |||
| 1405 | .clone(), | 1414 | .clone(), |
| 1406 | )?; | 1415 | )?; |
| 1407 | 1416 | ||
| 1408 | get_events_from_local_cache(git_repo.get_path()?, vec![ | 1417 | get_events_from_local_cache( |
| 1409 | nostr::Filter::default().id(proposal_or_revision_id), | 1418 | git_repo.get_path()?, |
| 1410 | ]) | 1419 | vec![nostr::Filter::default().id(proposal_or_revision_id)], |
| 1420 | ) | ||
| 1411 | .await? | 1421 | .await? |
| 1412 | .first() | 1422 | .first() |
| 1413 | .unwrap() | 1423 | .unwrap() |
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs index f7e688e..dc75872 100644 --- a/src/bin/git_remote_nostr/utils.rs +++ b/src/bin/git_remote_nostr/utils.rs | |||
| @@ -108,11 +108,14 @@ pub async fn get_open_or_draft_proposals( | |||
| 108 | .collect(); | 108 | .collect(); |
| 109 | 109 | ||
| 110 | let statuses: Vec<nostr::Event> = { | 110 | let statuses: Vec<nostr::Event> = { |
| 111 | let mut statuses = get_events_from_local_cache(git_repo_path, vec![ | 111 | let mut statuses = get_events_from_local_cache( |
| 112 | nostr::Filter::default() | 112 | git_repo_path, |
| 113 | .kinds(status_kinds().clone()) | 113 | vec![ |
| 114 | .events(proposals.iter().map(|e| e.id)), | 114 | nostr::Filter::default() |
| 115 | ]) | 115 | .kinds(status_kinds().clone()) |
| 116 | .events(proposals.iter().map(|e| e.id)), | ||
| 117 | ], | ||
| 118 | ) | ||
| 116 | .await?; | 119 | .await?; |
| 117 | statuses.sort_by_key(|e| e.created_at); | 120 | statuses.sort_by_key(|e| e.created_at); |
| 118 | statuses.reverse(); | 121 | statuses.reverse(); |
diff --git a/src/bin/ngit/sub_commands/list.rs b/src/bin/ngit/sub_commands/list.rs index 2c91e66..0330be1 100644 --- a/src/bin/ngit/sub_commands/list.rs +++ b/src/bin/ngit/sub_commands/list.rs | |||
| @@ -49,11 +49,14 @@ pub async fn launch() -> Result<()> { | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | let statuses: Vec<nostr::Event> = { | 51 | let statuses: Vec<nostr::Event> = { |
| 52 | let mut statuses = get_events_from_local_cache(git_repo_path, vec![ | 52 | let mut statuses = get_events_from_local_cache( |
| 53 | nostr::Filter::default() | 53 | git_repo_path, |
| 54 | .kinds(status_kinds().clone()) | 54 | vec![ |
| 55 | .events(proposals_and_revisions.iter().map(|e| e.id)), | 55 | nostr::Filter::default() |
| 56 | ]) | 56 | .kinds(status_kinds().clone()) |
| 57 | .events(proposals_and_revisions.iter().map(|e| e.id)), | ||
| 58 | ], | ||
| 59 | ) | ||
| 57 | .await?; | 60 | .await?; |
| 58 | statuses.sort_by_key(|e| e.created_at); | 61 | statuses.sort_by_key(|e| e.created_at); |
| 59 | statuses.reverse(); | 62 | statuses.reverse(); |
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs index 5a5acc8..c84e339 100644 --- a/src/bin/ngit/sub_commands/send.rs +++ b/src/bin/ngit/sub_commands/send.rs | |||
| @@ -378,9 +378,10 @@ async fn get_root_proposal_id_and_mentions_from_in_reply_to( | |||
| 378 | public_key: _, | 378 | public_key: _, |
| 379 | uppercase: false, | 379 | uppercase: false, |
| 380 | }) => { | 380 | }) => { |
| 381 | let events = get_events_from_local_cache(git_repo_path, vec![ | 381 | let events = get_events_from_local_cache( |
| 382 | nostr::Filter::new().id(*event_id), | 382 | git_repo_path, |
| 383 | ]) | 383 | vec![nostr::Filter::new().id(*event_id)], |
| 384 | ) | ||
| 384 | .await?; | 385 | .await?; |
| 385 | 386 | ||
| 386 | if let Some(first) = events.iter().find(|e| e.id.eq(event_id)) { | 387 | if let Some(first) = events.iter().find(|e| e.id.eq(event_id)) { |