aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/downloader/fossil_downloader_test.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-18 18:03:57 +0900
committernsfisis <nsfisis@gmail.com>2026-07-18 18:03:57 +0900
commit9b291d454b059977639db26c847af4e835cda0c3 (patch)
treee54770570a80e67681f1614841156b864452713c /crates/shirabe/tests/downloader/fossil_downloader_test.rs
parentf8e385f7a1bd752d39f4d4f87b0439596839dde9 (diff)
downloadphp-shirabe-9b291d454b059977639db26c847af4e835cda0c3.tar.gz
php-shirabe-9b291d454b059977639db26c847af4e835cda0c3.tar.zst
php-shirabe-9b291d454b059977639db26c847af4e835cda0c3.zip
refactor(downloader): take &self across the downloader hierarchy
Concurrent package operations call into the same downloader instances through Rc<RefCell<dyn DownloaderInterface>>; with &mut self methods every call holds a RefMut across its awaits, which panics with 'already mutably borrowed' the moment two operations overlap. This is groundwork for fanning out InstallationManager's download/install loops (same rework HttpDownloader/CurlDownloader already got). - DownloaderInterface/ChangeReportInterface/ArchiveDownloader/ VcsDownloader methods now take &self; as_change_report_interface returns &dyn instead of &mut dyn. - Implementors move their genuinely mutable state behind cells: FileDownloader.additional_cleanup_paths, the archive downloaders' cleanup_executed, ZipDownloader.zip_archive_object, VcsDownloaderBase.has_cleaned_changes, GitDownloader's stash/discard/ cache maps and GitUtil, SvnDownloader.cache_credentials, PerforceDownloader.perforce. FileDownloader.io gains a RefCell layer so get_local_changes can keep PHP's NullIO swap under &self. - ProcessExecutor::execute_async now returns a future that captures everything up front instead of borrowing the executor, and call sites build the future before awaiting, so no borrow on the shared executor is held while a subprocess runs. - Filesystem::remove_directory_async becomes remove_directory_async_via taking the Rc handle: the Filesystem is only borrowed for the sync head/tail, never across the rm subprocess await (sync borrow_mut users like rename/ensure_directory_exists would otherwise collide). - DownloadManager async call sites hold shared borrows only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/downloader/fossil_downloader_test.rs')
-rw-r--r--crates/shirabe/tests/downloader/fossil_downloader_test.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/shirabe/tests/downloader/fossil_downloader_test.rs b/crates/shirabe/tests/downloader/fossil_downloader_test.rs
index e473b2dd..d3b50a9f 100644
--- a/crates/shirabe/tests/downloader/fossil_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/fossil_downloader_test.rs
@@ -87,7 +87,7 @@ fn test_install_for_package_without_source_reference() {
let package = get_package(None, None);
let (process, _guard) = get_process_executor_mock(vec![], false, Default::default());
- let mut downloader = get_downloader_mock(None, None, process, None);
+ let downloader = get_downloader_mock(None, None, process, None);
let path = format!("{}/path", working_dir.path().to_string_lossy());
let result = run(downloader.install(package, &path));
@@ -121,7 +121,7 @@ fn test_install() {
Default::default(),
);
- let mut downloader = get_downloader_mock(None, None, process, None);
+ let downloader = get_downloader_mock(None, None, process, None);
run(downloader.install(package, &working_dir_str)).unwrap();
}
@@ -134,7 +134,7 @@ fn test_updatefor_package_without_source_reference() {
let source_package = get_package(None, None);
let (process, _guard) = get_process_executor_mock(vec![], false, Default::default());
- let mut downloader = get_downloader_mock(None, None, process, None);
+ let downloader = get_downloader_mock(None, None, process, None);
let result = run(async {
downloader
@@ -182,7 +182,7 @@ fn test_update() {
Default::default(),
);
- let mut downloader = get_downloader_mock(None, None, process, None);
+ let downloader = get_downloader_mock(None, None, process, None);
run(async {
downloader
.prepare(
@@ -229,7 +229,7 @@ fn test_remove() {
});
let filesystem = std::rc::Rc::new(std::cell::RefCell::new(filesystem));
- let mut downloader = get_downloader_mock(None, None, process, Some(filesystem.clone()));
+ let downloader = get_downloader_mock(None, None, process, Some(filesystem.clone()));
run(async {
downloader
.prepare("uninstall", package.clone(), &working_dir_str, None)