diff options
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/git_remote_nostr/fetch.rs | 10 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/list.rs | 6 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/main.rs | 6 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 62 | ||||
| -rw-r--r-- | src/bin/git_remote_nostr/utils.rs | 17 | ||||
| -rw-r--r-- | src/bin/ngit/cli.rs | 2 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/export_keys.rs | 2 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 12 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/list.rs | 19 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/login.rs | 4 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/logout.rs | 2 | ||||
| -rw-r--r-- | src/bin/ngit/sub_commands/send.rs | 17 |
12 files changed, 71 insertions, 88 deletions
diff --git a/src/bin/git_remote_nostr/fetch.rs b/src/bin/git_remote_nostr/fetch.rs index 458c6d8..7012955 100644 --- a/src/bin/git_remote_nostr/fetch.rs +++ b/src/bin/git_remote_nostr/fetch.rs | |||
| @@ -6,15 +6,15 @@ use std::{ | |||
| 6 | time::Instant, | 6 | time::Instant, |
| 7 | }; | 7 | }; |
| 8 | 8 | ||
| 9 | use anyhow::{anyhow, bail, Context, Result}; | 9 | use anyhow::{Context, Result, anyhow, bail}; |
| 10 | use auth_git2::GitAuthenticator; | 10 | use auth_git2::GitAuthenticator; |
| 11 | use git2::{Progress, Repository}; | 11 | use git2::{Progress, Repository}; |
| 12 | use ngit::{ | 12 | use ngit::{ |
| 13 | cli_interactor::count_lines_per_msg_vec, | 13 | cli_interactor::count_lines_per_msg_vec, |
| 14 | git::{ | 14 | git::{ |
| 15 | Repo, RepoActions, | ||
| 15 | nostr_url::{CloneUrl, NostrUrlDecoded, ServerProtocol}, | 16 | nostr_url::{CloneUrl, NostrUrlDecoded, ServerProtocol}, |
| 16 | utils::check_ssh_keys, | 17 | utils::check_ssh_keys, |
| 17 | Repo, RepoActions, | ||
| 18 | }, | 18 | }, |
| 19 | git_events::tag_value, | 19 | git_events::tag_value, |
| 20 | login::get_curent_user, | 20 | login::get_curent_user, |
| @@ -24,9 +24,9 @@ use nostr::nips::nip19; | |||
| 24 | use nostr_sdk::{Event, ToBech32}; | 24 | use nostr_sdk::{Event, ToBech32}; |
| 25 | 25 | ||
| 26 | use crate::utils::{ | 26 | use crate::utils::{ |
| 27 | fetch_or_list_error_is_not_authentication_failure, find_proposal_and_patches_by_branch_name, | 27 | Direction, fetch_or_list_error_is_not_authentication_failure, |
| 28 | get_oids_from_fetch_batch, get_open_proposals, get_read_protocols_to_try, join_with_and, | 28 | find_proposal_and_patches_by_branch_name, get_oids_from_fetch_batch, get_open_proposals, |
| 29 | set_protocol_preference, Direction, | 29 | get_read_protocols_to_try, join_with_and, set_protocol_preference, |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | pub async fn run_fetch( | 32 | pub async fn run_fetch( |
diff --git a/src/bin/git_remote_nostr/list.rs b/src/bin/git_remote_nostr/list.rs index 9171544..bba15aa 100644 --- a/src/bin/git_remote_nostr/list.rs +++ b/src/bin/git_remote_nostr/list.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | use core::str; | 1 | use core::str; |
| 2 | use std::collections::HashMap; | 2 | use std::collections::HashMap; |
| 3 | 3 | ||
| 4 | use anyhow::{anyhow, Context, Result}; | 4 | use anyhow::{Context, Result, anyhow}; |
| 5 | use auth_git2::GitAuthenticator; | 5 | use auth_git2::GitAuthenticator; |
| 6 | use client::get_state_from_cache; | 6 | use client::get_state_from_cache; |
| 7 | use git::RepoActions; | 7 | use git::RepoActions; |
| @@ -22,9 +22,9 @@ use crate::{ | |||
| 22 | fetch::{fetch_from_git_server, make_commits_for_proposal}, | 22 | fetch::{fetch_from_git_server, make_commits_for_proposal}, |
| 23 | git::Repo, | 23 | git::Repo, |
| 24 | utils::{ | 24 | utils::{ |
| 25 | fetch_or_list_error_is_not_authentication_failure, get_open_proposals, | 25 | Direction, fetch_or_list_error_is_not_authentication_failure, get_open_proposals, |
| 26 | get_read_protocols_to_try, get_short_git_server_name, join_with_and, | 26 | get_read_protocols_to_try, get_short_git_server_name, join_with_and, |
| 27 | set_protocol_preference, Direction, | 27 | set_protocol_preference, |
| 28 | }, | 28 | }, |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs index 1a21341..e6f7af3 100644 --- a/src/bin/git_remote_nostr/main.rs +++ b/src/bin/git_remote_nostr/main.rs | |||
| @@ -11,9 +11,9 @@ use std::{ | |||
| 11 | path::{Path, PathBuf}, | 11 | path::{Path, PathBuf}, |
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | use anyhow::{bail, Context, Result}; | 14 | use anyhow::{Context, Result, bail}; |
| 15 | use client::{consolidate_fetch_reports, get_repo_ref_from_cache, Connect}; | 15 | use client::{Connect, consolidate_fetch_reports, get_repo_ref_from_cache}; |
| 16 | use git::{nostr_url::NostrUrlDecoded, RepoActions}; | 16 | use git::{RepoActions, nostr_url::NostrUrlDecoded}; |
| 17 | use ngit::{client, git, login::existing::load_existing_login}; | 17 | use ngit::{client, git, login::existing::load_existing_login}; |
| 18 | use nostr::nips::nip01::Coordinate; | 18 | use nostr::nips::nip01::Coordinate; |
| 19 | use utils::read_line; | 19 | use utils::read_line; |
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index f2ac169..e8e1587 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -6,17 +6,17 @@ use std::{ | |||
| 6 | time::Instant, | 6 | time::Instant, |
| 7 | }; | 7 | }; |
| 8 | 8 | ||
| 9 | use anyhow::{anyhow, bail, Context, Result}; | 9 | use anyhow::{Context, Result, anyhow, bail}; |
| 10 | use auth_git2::GitAuthenticator; | 10 | use auth_git2::GitAuthenticator; |
| 11 | use client::{ | 11 | use client::{ |
| 12 | get_events_from_local_cache, get_state_from_cache, send_events, sign_event, STATE_KIND, | 12 | STATE_KIND, get_events_from_local_cache, get_state_from_cache, send_events, sign_event, |
| 13 | }; | 13 | }; |
| 14 | use console::Term; | 14 | use console::Term; |
| 15 | use git::{sha1_to_oid, RepoActions}; | 15 | use git::{RepoActions, sha1_to_oid}; |
| 16 | use git2::{Oid, Repository}; | ||
| 17 | use git_events::{ | 16 | use git_events::{ |
| 18 | generate_cover_letter_and_patch_events, generate_patch_event, get_commit_id_from_patch, | 17 | generate_cover_letter_and_patch_events, generate_patch_event, get_commit_id_from_patch, |
| 19 | }; | 18 | }; |
| 19 | use git2::{Oid, Repository}; | ||
| 20 | use ngit::{ | 20 | use ngit::{ |
| 21 | cli_interactor::count_lines_per_msg_vec, | 21 | cli_interactor::count_lines_per_msg_vec, |
| 22 | client::{self, get_event_from_cache_by_id}, | 22 | client::{self, get_event_from_cache_by_id}, |
| @@ -32,8 +32,8 @@ use ngit::{ | |||
| 32 | }; | 32 | }; |
| 33 | use nostr::nips::nip10::Marker; | 33 | use nostr::nips::nip10::Marker; |
| 34 | use nostr_sdk::{ | 34 | use nostr_sdk::{ |
| 35 | hashes::sha1::Hash as Sha1Hash, Event, EventBuilder, EventId, Kind, NostrSigner, PublicKey, | 35 | Event, EventBuilder, EventId, Kind, NostrSigner, PublicKey, RelayUrl, Tag, |
| 36 | RelayUrl, Tag, | 36 | hashes::sha1::Hash as Sha1Hash, |
| 37 | }; | 37 | }; |
| 38 | use repo_ref::RepoRef; | 38 | use repo_ref::RepoRef; |
| 39 | use repo_state::RepoState; | 39 | use repo_state::RepoState; |
| @@ -43,9 +43,10 @@ use crate::{ | |||
| 43 | git::Repo, | 43 | git::Repo, |
| 44 | list::list_from_remotes, | 44 | list::list_from_remotes, |
| 45 | utils::{ | 45 | utils::{ |
| 46 | find_proposal_and_patches_by_branch_name, get_all_proposals, get_remote_name_by_url, | 46 | Direction, find_proposal_and_patches_by_branch_name, get_all_proposals, |
| 47 | get_short_git_server_name, get_write_protocols_to_try, join_with_and, | 47 | get_remote_name_by_url, get_short_git_server_name, get_write_protocols_to_try, |
| 48 | push_error_is_not_authentication_failure, read_line, set_protocol_preference, Direction, | 48 | join_with_and, push_error_is_not_authentication_failure, read_line, |
| 49 | set_protocol_preference, | ||
| 49 | }, | 50 | }, |
| 50 | }; | 51 | }; |
| 51 | 52 | ||
| @@ -1023,13 +1024,10 @@ async fn get_merged_status_events( | |||
| 1023 | let (ahead, _) = | 1024 | let (ahead, _) = |
| 1024 | git_repo.get_commits_ahead_behind(&tip_of_remote_branch, &tip_of_pushed_branch)?; | 1025 | git_repo.get_commits_ahead_behind(&tip_of_remote_branch, &tip_of_pushed_branch)?; |
| 1025 | 1026 | ||
| 1026 | let commit_events = get_events_from_local_cache( | 1027 | let commit_events = get_events_from_local_cache(git_repo.get_path()?, vec![ |
| 1027 | git_repo.get_path()?, | 1028 | nostr::Filter::default().kind(nostr::Kind::GitPatch), |
| 1028 | vec![ | 1029 | // TODO: limit by repo_ref |
| 1029 | nostr::Filter::default().kind(nostr::Kind::GitPatch), | 1030 | ]) |
| 1030 | // TODO: limit by repo_ref | ||
| 1031 | ], | ||
| 1032 | ) | ||
| 1033 | .await?; | 1031 | .await?; |
| 1034 | 1032 | ||
| 1035 | let merged_proposals_info = | 1033 | let merged_proposals_info = |
| @@ -1106,12 +1104,9 @@ async fn get_merged_proposals_info( | |||
| 1106 | proposals.entry(proposal_id).or_default(); | 1104 | proposals.entry(proposal_id).or_default(); |
| 1107 | // ignore revisions without all the merged commits | 1105 | // ignore revisions without all the merged commits |
| 1108 | if entry_revision_id == &revision_id { | 1106 | if entry_revision_id == &revision_id { |
| 1109 | merged_patches.insert( | 1107 | merged_patches.insert(*commit_hash, MergedPRCommitType::PatchCommit { |
| 1110 | *commit_hash, | 1108 | event_id: patch_event.id, |
| 1111 | MergedPRCommitType::PatchCommit { | 1109 | }); |
| 1112 | event_id: patch_event.id, | ||
| 1113 | }, | ||
| 1114 | ); | ||
| 1115 | } | 1110 | } |
| 1116 | } | 1111 | } |
| 1117 | } | 1112 | } |
| @@ -1136,12 +1131,9 @@ async fn get_merged_proposals_info( | |||
| 1136 | proposals.entry(proposal_id).or_default(); | 1131 | proposals.entry(proposal_id).or_default(); |
| 1137 | // ignore revisions without all the applied commits | 1132 | // ignore revisions without all the applied commits |
| 1138 | if entry_revision_id == &revision_id { | 1133 | if entry_revision_id == &revision_id { |
| 1139 | merged_patches.insert( | 1134 | merged_patches.insert(*commit_hash, MergedPRCommitType::PatchApplied { |
| 1140 | *commit_hash, | 1135 | event_id: patch_event.id, |
| 1141 | MergedPRCommitType::PatchApplied { | 1136 | }); |
| 1142 | event_id: patch_event.id, | ||
| 1143 | }, | ||
| 1144 | ); | ||
| 1145 | } | 1137 | } |
| 1146 | } | 1138 | } |
| 1147 | } | 1139 | } |
| @@ -1379,10 +1371,9 @@ async fn get_proposal_and_revision_root_from_patch( | |||
| 1379 | .clone(), | 1371 | .clone(), |
| 1380 | )?; | 1372 | )?; |
| 1381 | 1373 | ||
| 1382 | get_events_from_local_cache( | 1374 | get_events_from_local_cache(git_repo.get_path()?, vec![ |
| 1383 | git_repo.get_path()?, | 1375 | nostr::Filter::default().id(proposal_or_revision_id), |
| 1384 | vec![nostr::Filter::default().id(proposal_or_revision_id)], | 1376 | ]) |
| 1385 | ) | ||
| 1386 | .await? | 1377 | .await? |
| 1387 | .first() | 1378 | .first() |
| 1388 | .unwrap() | 1379 | .unwrap() |
| @@ -1538,10 +1529,9 @@ impl BuildRepoState for RepoState { | |||
| 1538 | ) -> Result<RepoState> { | 1529 | ) -> Result<RepoState> { |
| 1539 | let mut tags = vec![Tag::identifier(identifier.clone())]; | 1530 | let mut tags = vec![Tag::identifier(identifier.clone())]; |
| 1540 | for (name, value) in &state { | 1531 | for (name, value) in &state { |
| 1541 | tags.push(Tag::custom( | 1532 | tags.push(Tag::custom(nostr_sdk::TagKind::Custom(name.into()), vec![ |
| 1542 | nostr_sdk::TagKind::Custom(name.into()), | 1533 | value.clone(), |
| 1543 | vec![value.clone()], | 1534 | ])); |
| 1544 | )); | ||
| 1545 | } | 1535 | } |
| 1546 | let event = sign_event(EventBuilder::new(STATE_KIND, "").tags(tags), signer).await?; | 1536 | let event = sign_event(EventBuilder::new(STATE_KIND, "").tags(tags), signer).await?; |
| 1547 | Ok(RepoState { | 1537 | Ok(RepoState { |
diff --git a/src/bin/git_remote_nostr/utils.rs b/src/bin/git_remote_nostr/utils.rs index 8e89652..15ebb10 100644 --- a/src/bin/git_remote_nostr/utils.rs +++ b/src/bin/git_remote_nostr/utils.rs | |||
| @@ -6,7 +6,7 @@ use std::{ | |||
| 6 | str::FromStr, | 6 | str::FromStr, |
| 7 | }; | 7 | }; |
| 8 | 8 | ||
| 9 | use anyhow::{bail, Context, Result}; | 9 | use anyhow::{Context, Result, bail}; |
| 10 | use git2::Repository; | 10 | use git2::Repository; |
| 11 | use ngit::{ | 11 | use ngit::{ |
| 12 | client::{ | 12 | client::{ |
| @@ -14,8 +14,8 @@ use ngit::{ | |||
| 14 | get_proposals_and_revisions_from_cache, | 14 | get_proposals_and_revisions_from_cache, |
| 15 | }, | 15 | }, |
| 16 | git::{ | 16 | git::{ |
| 17 | nostr_url::{CloneUrl, NostrUrlDecoded, ServerProtocol}, | ||
| 18 | Repo, RepoActions, | 17 | Repo, RepoActions, |
| 18 | nostr_url::{CloneUrl, NostrUrlDecoded, ServerProtocol}, | ||
| 19 | }, | 19 | }, |
| 20 | git_events::{ | 20 | git_events::{ |
| 21 | event_is_revision_root, get_most_recent_patch_with_ancestors, | 21 | event_is_revision_root, get_most_recent_patch_with_ancestors, |
| @@ -108,14 +108,11 @@ pub async fn get_open_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( | 111 | let mut statuses = get_events_from_local_cache(git_repo_path, vec![ |
| 112 | git_repo_path, | 112 | nostr::Filter::default() |
| 113 | vec![ | 113 | .kinds(status_kinds().clone()) |
| 114 | nostr::Filter::default() | 114 | .events(proposals.iter().map(|e| e.id)), |
| 115 | .kinds(status_kinds().clone()) | 115 | ]) |
| 116 | .events(proposals.iter().map(|e| e.id)), | ||
| 117 | ], | ||
| 118 | ) | ||
| 119 | .await?; | 116 | .await?; |
| 120 | statuses.sort_by_key(|e| e.created_at); | 117 | statuses.sort_by_key(|e| e.created_at); |
| 121 | statuses.reverse(); | 118 | statuses.reverse(); |
diff --git a/src/bin/ngit/cli.rs b/src/bin/ngit/cli.rs index 1737a9f..60bc5d2 100644 --- a/src/bin/ngit/cli.rs +++ b/src/bin/ngit/cli.rs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | use anyhow::{bail, Result}; | 1 | use anyhow::{Result, bail}; |
| 2 | use clap::{Parser, Subcommand}; | 2 | use clap::{Parser, Subcommand}; |
| 3 | use ngit::login::SignerInfo; | 3 | use ngit::login::SignerInfo; |
| 4 | 4 | ||
diff --git a/src/bin/ngit/sub_commands/export_keys.rs b/src/bin/ngit/sub_commands/export_keys.rs index 54a716f..45b1b89 100644 --- a/src/bin/ngit/sub_commands/export_keys.rs +++ b/src/bin/ngit/sub_commands/export_keys.rs | |||
| @@ -2,9 +2,9 @@ use anyhow::{Context, Result}; | |||
| 2 | use ngit::{ | 2 | use ngit::{ |
| 3 | cli_interactor::{Interactor, InteractorPrompt, PromptChoiceParms}, | 3 | cli_interactor::{Interactor, InteractorPrompt, PromptChoiceParms}, |
| 4 | login::{ | 4 | login::{ |
| 5 | SignerInfo, SignerInfoSource, | ||
| 5 | existing::{get_signer_info, load_existing_login}, | 6 | existing::{get_signer_info, load_existing_login}, |
| 6 | fresh::generate_qr, | 7 | fresh::generate_qr, |
| 7 | SignerInfo, SignerInfoSource, | ||
| 8 | }, | 8 | }, |
| 9 | }; | 9 | }; |
| 10 | 10 | ||
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 0894f41..80e182b 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -3,18 +3,18 @@ use std::collections::HashMap; | |||
| 3 | use anyhow::{Context, Result}; | 3 | use anyhow::{Context, Result}; |
| 4 | use console::Style; | 4 | use console::Style; |
| 5 | use ngit::{cli_interactor::PromptConfirmParms, git::nostr_url::NostrUrlDecoded}; | 5 | use ngit::{cli_interactor::PromptConfirmParms, git::nostr_url::NostrUrlDecoded}; |
| 6 | use nostr::{nips::nip01::Coordinate, FromBech32, PublicKey, ToBech32}; | 6 | use nostr::{FromBech32, PublicKey, ToBech32, nips::nip01::Coordinate}; |
| 7 | use nostr_sdk::{Kind, RelayUrl}; | 7 | use nostr_sdk::{Kind, RelayUrl}; |
| 8 | 8 | ||
| 9 | use crate::{ | 9 | use crate::{ |
| 10 | cli::{extract_signer_cli_arguments, Cli}, | 10 | cli::{Cli, extract_signer_cli_arguments}, |
| 11 | cli_interactor::{Interactor, InteractorPrompt, PromptInputParms}, | 11 | cli_interactor::{Interactor, InteractorPrompt, PromptInputParms}, |
| 12 | client::{fetching_with_report, get_repo_ref_from_cache, send_events, Client, Connect}, | 12 | client::{Client, Connect, fetching_with_report, get_repo_ref_from_cache, send_events}, |
| 13 | git::{nostr_url::convert_clone_url_to_https, Repo, RepoActions}, | 13 | git::{Repo, RepoActions, nostr_url::convert_clone_url_to_https}, |
| 14 | login, | 14 | login, |
| 15 | repo_ref::{ | 15 | repo_ref::{ |
| 16 | extract_pks, get_repo_config_from_yaml, save_repo_config_to_yaml, | 16 | RepoRef, extract_pks, get_repo_config_from_yaml, save_repo_config_to_yaml, |
| 17 | try_and_get_repo_coordinates_when_remote_unknown, RepoRef, | 17 | try_and_get_repo_coordinates_when_remote_unknown, |
| 18 | }, | 18 | }, |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
diff --git a/src/bin/ngit/sub_commands/list.rs b/src/bin/ngit/sub_commands/list.rs index ee015ef..9b84c1b 100644 --- a/src/bin/ngit/sub_commands/list.rs +++ b/src/bin/ngit/sub_commands/list.rs | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | use std::{io::Write, ops::Add}; | 1 | use std::{io::Write, ops::Add}; |
| 2 | 2 | ||
| 3 | use anyhow::{bail, Context, Result}; | 3 | use anyhow::{Context, Result, bail}; |
| 4 | use ngit::{ | 4 | use ngit::{ |
| 5 | client::{get_all_proposal_patch_events_from_cache, get_proposals_and_revisions_from_cache}, | 5 | client::{get_all_proposal_patch_events_from_cache, get_proposals_and_revisions_from_cache}, |
| 6 | git_events::{ | 6 | git_events::{ |
| @@ -12,9 +12,9 @@ use nostr_sdk::Kind; | |||
| 12 | use crate::{ | 12 | use crate::{ |
| 13 | cli_interactor::{Interactor, InteractorPrompt, PromptChoiceParms, PromptConfirmParms}, | 13 | cli_interactor::{Interactor, InteractorPrompt, PromptChoiceParms, PromptConfirmParms}, |
| 14 | client::{ | 14 | client::{ |
| 15 | fetching_with_report, get_events_from_local_cache, get_repo_ref_from_cache, Client, Connect, | 15 | Client, Connect, fetching_with_report, get_events_from_local_cache, get_repo_ref_from_cache, |
| 16 | }, | 16 | }, |
| 17 | git::{str_to_sha1, Repo, RepoActions}, | 17 | git::{Repo, RepoActions, str_to_sha1}, |
| 18 | git_events::{ | 18 | git_events::{ |
| 19 | commit_msg_from_patch_oneliner, event_is_revision_root, event_to_cover_letter, | 19 | commit_msg_from_patch_oneliner, event_is_revision_root, event_to_cover_letter, |
| 20 | patch_supports_commit_ids, | 20 | patch_supports_commit_ids, |
| @@ -47,14 +47,11 @@ pub async fn launch() -> Result<()> { | |||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | let statuses: Vec<nostr::Event> = { | 49 | let statuses: Vec<nostr::Event> = { |
| 50 | let mut statuses = get_events_from_local_cache( | 50 | let mut statuses = get_events_from_local_cache(git_repo_path, vec![ |
| 51 | git_repo_path, | 51 | nostr::Filter::default() |
| 52 | vec![ | 52 | .kinds(status_kinds().clone()) |
| 53 | nostr::Filter::default() | 53 | .events(proposals_and_revisions.iter().map(|e| e.id)), |
| 54 | .kinds(status_kinds().clone()) | 54 | ]) |
| 55 | .events(proposals_and_revisions.iter().map(|e| e.id)), | ||
| 56 | ], | ||
| 57 | ) | ||
| 58 | .await?; | 55 | .await?; |
| 59 | statuses.sort_by_key(|e| e.created_at); | 56 | statuses.sort_by_key(|e| e.created_at); |
| 60 | statuses.reverse(); | 57 | statuses.reverse(); |
diff --git a/src/bin/ngit/sub_commands/login.rs b/src/bin/ngit/sub_commands/login.rs index ccbdf01..06236ec 100644 --- a/src/bin/ngit/sub_commands/login.rs +++ b/src/bin/ngit/sub_commands/login.rs | |||
| @@ -3,11 +3,11 @@ use clap; | |||
| 3 | use ngit::{ | 3 | use ngit::{ |
| 4 | cli_interactor::{Interactor, InteractorPrompt, PromptChoiceParms}, | 4 | cli_interactor::{Interactor, InteractorPrompt, PromptChoiceParms}, |
| 5 | git::{get_git_config_item, remove_git_config_item}, | 5 | git::{get_git_config_item, remove_git_config_item}, |
| 6 | login::{existing::load_existing_login, SignerInfoSource}, | 6 | login::{SignerInfoSource, existing::load_existing_login}, |
| 7 | }; | 7 | }; |
| 8 | 8 | ||
| 9 | use crate::{ | 9 | use crate::{ |
| 10 | cli::{extract_signer_cli_arguments, Cli}, | 10 | cli::{Cli, extract_signer_cli_arguments}, |
| 11 | client::{Client, Connect}, | 11 | client::{Client, Connect}, |
| 12 | git::Repo, | 12 | git::Repo, |
| 13 | login::fresh::fresh_login_or_signup, | 13 | login::fresh::fresh_login_or_signup, |
diff --git a/src/bin/ngit/sub_commands/logout.rs b/src/bin/ngit/sub_commands/logout.rs index f3f9620..2df96c8 100644 --- a/src/bin/ngit/sub_commands/logout.rs +++ b/src/bin/ngit/sub_commands/logout.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | use anyhow::{Context, Result}; | 1 | use anyhow::{Context, Result}; |
| 2 | use ngit::{ | 2 | use ngit::{ |
| 3 | git::remove_git_config_item, | 3 | git::remove_git_config_item, |
| 4 | login::{existing::load_existing_login, SignerInfoSource}, | 4 | login::{SignerInfoSource, existing::load_existing_login}, |
| 5 | }; | 5 | }; |
| 6 | 6 | ||
| 7 | use crate::{ | 7 | use crate::{ |
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs index c6c75c9..7c898bc 100644 --- a/src/bin/ngit/sub_commands/send.rs +++ b/src/bin/ngit/sub_commands/send.rs | |||
| @@ -1,23 +1,23 @@ | |||
| 1 | use std::path::Path; | 1 | use std::path::Path; |
| 2 | 2 | ||
| 3 | use anyhow::{bail, Context, Result}; | 3 | use anyhow::{Context, Result, bail}; |
| 4 | use console::Style; | 4 | use console::Style; |
| 5 | use ngit::{client::send_events, git_events::generate_cover_letter_and_patch_events}; | 5 | use ngit::{client::send_events, git_events::generate_cover_letter_and_patch_events}; |
| 6 | use nostr::{ | 6 | use nostr::{ |
| 7 | nips::{nip10::Marker, nip19::Nip19Event}, | ||
| 8 | ToBech32, | 7 | ToBech32, |
| 8 | nips::{nip10::Marker, nip19::Nip19Event}, | ||
| 9 | }; | 9 | }; |
| 10 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; | 10 | use nostr_sdk::hashes::sha1::Hash as Sha1Hash; |
| 11 | 11 | ||
| 12 | use crate::{ | 12 | use crate::{ |
| 13 | cli::{extract_signer_cli_arguments, Cli}, | 13 | cli::{Cli, extract_signer_cli_arguments}, |
| 14 | cli_interactor::{ | 14 | cli_interactor::{ |
| 15 | Interactor, InteractorPrompt, PromptConfirmParms, PromptInputParms, PromptMultiChoiceParms, | 15 | Interactor, InteractorPrompt, PromptConfirmParms, PromptInputParms, PromptMultiChoiceParms, |
| 16 | }, | 16 | }, |
| 17 | client::{ | 17 | client::{ |
| 18 | fetching_with_report, get_events_from_local_cache, get_repo_ref_from_cache, Client, Connect, | 18 | Client, Connect, fetching_with_report, get_events_from_local_cache, get_repo_ref_from_cache, |
| 19 | }, | 19 | }, |
| 20 | git::{identify_ahead_behind, Repo, RepoActions}, | 20 | git::{Repo, RepoActions, identify_ahead_behind}, |
| 21 | git_events::{event_is_patch_set_root, event_tag_from_nip19_or_hex}, | 21 | git_events::{event_is_patch_set_root, event_tag_from_nip19_or_hex}, |
| 22 | login, | 22 | login, |
| 23 | repo_ref::get_repo_coordinates_when_remote_unknown, | 23 | repo_ref::get_repo_coordinates_when_remote_unknown, |
| @@ -369,10 +369,9 @@ async fn get_root_proposal_id_and_mentions_from_in_reply_to( | |||
| 369 | public_key: _, | 369 | public_key: _, |
| 370 | uppercase: false, | 370 | uppercase: false, |
| 371 | }) => { | 371 | }) => { |
| 372 | let events = get_events_from_local_cache( | 372 | let events = get_events_from_local_cache(git_repo_path, vec![ |
| 373 | git_repo_path, | 373 | nostr::Filter::new().id(*event_id), |
| 374 | vec![nostr::Filter::new().id(*event_id)], | 374 | ]) |
| 375 | ) | ||
| 376 | .await?; | 375 | .await?; |
| 377 | 376 | ||
| 378 | if let Some(first) = events.iter().find(|e| e.id.eq(event_id)) { | 377 | if let Some(first) = events.iter().find(|e| e.id.eq(event_id)) { |