From 82c7a95f6e9aa266d2f0d2035a0ce4f1715b62ad Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 13 Nov 2025 17:18:35 +0000 Subject: feat(list): make list async and include sync report inline copy relay fetching approach to async and reporting --- src/bin/git_remote_nostr/list.rs | 16 +++++----------- src/bin/git_remote_nostr/push.rs | 8 ++++++-- src/bin/ngit/sub_commands/sync.rs | 10 ++++++++-- 3 files changed, 19 insertions(+), 15 deletions(-) (limited to 'src/bin') diff --git a/src/bin/git_remote_nostr/list.rs b/src/bin/git_remote_nostr/list.rs index d06d202..7753ba1 100644 --- a/src/bin/git_remote_nostr/list.rs +++ b/src/bin/git_remote_nostr/list.rs @@ -8,7 +8,7 @@ use ngit::{ fetch::fetch_from_git_server, git::{self}, git_events::{KIND_PULL_REQUEST, KIND_PULL_REQUEST_UPDATE, event_to_cover_letter, tag_value}, - list::{generate_remote_sync_warnings, identify_remote_sync_issues, list_from_remotes}, + list::list_from_remotes, login::get_curent_user, repo_ref::{self}, utils::{get_all_proposals, get_open_or_draft_proposals}, @@ -27,23 +27,17 @@ pub async fn run_list( let term = console::Term::stderr(); + term.write_line("git servers: listing refs...")?; let remote_states = list_from_remotes( &term, git_repo, &repo_ref.git_server, &repo_ref.to_nostr_git_url(&None), - ); + nostr_state.as_ref(), + ) + .await; let mut state = if let Some(nostr_state) = nostr_state { - // Identify sync issues using shared abstraction - let remote_issues = identify_remote_sync_issues(git_repo, &nostr_state, &remote_states); - - // Generate and print warnings - let warnings = generate_remote_sync_warnings(&remote_issues, &remote_states); - for warning in warnings { - term.write_line(&warning)?; - } - nostr_state.state } else { let (state, _is_grasp_server) = repo_ref diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 12350e7..9cf2c52 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs @@ -69,14 +69,18 @@ pub async fn run_push( let term = console::Term::stderr(); - let list_outputs = list_outputs.unwrap_or_else(|| { + let list_outputs = if let Some(outputs) = list_outputs { + outputs + } else { list_from_remotes( &term, git_repo, &repo_ref.git_server, &repo_ref.to_nostr_git_url(&None), + None, ) - }); + .await + }; let existing_state = { // if no state events - create from first git server listed diff --git a/src/bin/ngit/sub_commands/sync.rs b/src/bin/ngit/sub_commands/sync.rs index d84feb6..daebb1b 100644 --- a/src/bin/ngit/sub_commands/sync.rs +++ b/src/bin/ngit/sub_commands/sync.rs @@ -77,8 +77,14 @@ pub async fn launch(args: &SubCommandArgs) -> Result<()> { let term = console::Term::stderr(); - let remote_states = - list_from_remotes(&term, &git_repo, &repo_ref.git_server, &decoded_nostr_url); + let remote_states = list_from_remotes( + &term, + &git_repo, + &repo_ref.git_server, + &decoded_nostr_url, + Some(&nostr_state), + ) + .await; let missing_refs = fetch_missing_refs(&git_repo, &nostr_state, &remote_states, &decoded_nostr_url); -- cgit v1.2.3