From 771f944af447c202eba045936a36dee71ab797ac Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 4 Sep 2024 11:32:05 +0100 Subject: refactor: fix imports, etc based on restructure move some functions out of ngit and into lib/mod and lib/git_events remove MockConnect from binaries so it is only used in the library. this was done: * mainly because automocks were not being imported from lib into each binary * but also because the these functions were being tested with MockConnect --- src/bin/ngit/sub_commands/pull.rs | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'src/bin/ngit/sub_commands/pull.rs') diff --git a/src/bin/ngit/sub_commands/pull.rs b/src/bin/ngit/sub_commands/pull.rs index e33a744..b66422d 100644 --- a/src/bin/ngit/sub_commands/pull.rs +++ b/src/bin/ngit/sub_commands/pull.rs @@ -1,21 +1,16 @@ use anyhow::{bail, Context, Result}; -use super::{ - list::{ - get_all_proposal_patch_events_from_cache, get_commit_id_from_patch, - get_proposals_and_revisions_from_cache, tag_value, - }, - send::event_to_cover_letter, -}; -#[cfg(test)] -use crate::client::MockConnect; -#[cfg(not(test))] -use crate::client::{Client, Connect}; use crate::{ - client::{fetching_with_report, get_repo_ref_from_cache}, + client::{ + fetching_with_report, get_all_proposal_patch_events_from_cache, + get_proposals_and_revisions_from_cache, get_repo_ref_from_cache, Client, Connect, + }, git::{str_to_sha1, Repo, RepoActions}, + git_events::{ + event_is_revision_root, event_to_cover_letter, get_commit_id_from_patch, + get_most_recent_patch_with_ancestors, tag_value, + }, repo_ref::get_repo_coordinates, - sub_commands::{list::get_most_recent_patch_with_ancestors, send::event_is_revision_root}, }; #[allow(clippy::too_many_lines)] @@ -34,10 +29,7 @@ pub async fn launch() -> Result<()> { if branch_name == main_or_master_branch_name { bail!("checkout a branch associated with a proposal first") } - #[cfg(not(test))] let client = Client::default(); - #[cfg(test)] - let client = ::default(); let repo_coordinates = get_repo_coordinates(&git_repo, &client).await?; -- cgit v1.2.3