From cd25c3e193f05a5e89bca2a1c706c85fdc9c9155 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 02:13:59 +0900 Subject: refactor(repository): make read methods fallible and take &mut self Change RepositoryInterface and WritableRepositoryInterface read methods (find_package, find_packages, get_packages, load_packages, search, get_providers, get_canonical_packages) to take &mut self and return anyhow::Result, so lazy-loading repositories such as ComposerRepository can perform fallible I/O and mutate internal state on access. Update all implementors and call sites to propagate the Result and pass mutable references. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/fund_command.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/command/fund_command.rs') diff --git a/crates/shirabe/src/command/fund_command.rs b/crates/shirabe/src/command/fund_command.rs index a01a67c..0fab473 100644 --- a/crates/shirabe/src/command/fund_command.rs +++ b/crates/shirabe/src/command/fund_command.rs @@ -56,7 +56,7 @@ impl FundCommand { let repository_manager = composer.get_repository_manager().clone(); let repository_manager = repository_manager.borrow(); let repo = repository_manager.get_local_repository(); - let remote_repos = CompositeRepository::new( + let mut remote_repos = CompositeRepository::new( repository_manager .get_repositories() .iter() @@ -67,7 +67,7 @@ impl FundCommand { let mut packages_to_load: IndexMap> = IndexMap::new(); let mut packages_to_load_names: indexmap::IndexSet = indexmap::IndexSet::new(); - for package in repo.get_packages() { + for package in repo.get_packages()? { if package.as_alias().is_some() { continue; } @@ -84,7 +84,7 @@ impl FundCommand { IndexMap::from([("dev".to_string(), base_package::STABILITY_DEV)]), IndexMap::new(), IndexMap::new(), - ); + )?; // collect funding data from default branches for (_, package) in &result.packages { @@ -103,7 +103,7 @@ impl FundCommand { } // collect funding from installed packages if none was found in the default branch above - for package in repo.get_packages() { + for package in repo.get_packages()? { if package.as_alias().is_some() || !packages_to_load_names.contains(&package.get_name()) { continue; -- cgit v1.3.1