diff options
Diffstat (limited to 'crates/shirabe/src/downloader/svn_downloader.rs')
| -rw-r--r-- | crates/shirabe/src/downloader/svn_downloader.rs | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/crates/shirabe/src/downloader/svn_downloader.rs b/crates/shirabe/src/downloader/svn_downloader.rs index b2dd7f58..576a2676 100644 --- a/crates/shirabe/src/downloader/svn_downloader.rs +++ b/crates/shirabe/src/downloader/svn_downloader.rs @@ -21,7 +21,7 @@ use shirabe_php_shim::{PhpMixed, RuntimeException, is_dir, php_regex, version_co #[derive(Debug)] pub struct SvnDownloader { inner: VcsDownloaderBase, - pub(crate) cache_credentials: bool, + pub(crate) cache_credentials: std::cell::Cell<bool>, } impl SvnDownloader { @@ -33,7 +33,7 @@ impl SvnDownloader { ) -> Self { Self { inner: VcsDownloaderBase::new(io, config, Some(process), Some(fs)), - cache_credentials: true, + cache_credentials: std::cell::Cell::new(true), } } @@ -52,7 +52,7 @@ impl SvnDownloader { self.inner.config.clone(), Some(self.inner.process.clone()), ); - util.set_cache_credentials(self.cache_credentials); + util.set_cache_credentials(self.cache_credentials.get()); util.execute(command, url, cwd, path, self.inner.io.is_verbose()) .map_err(|e| { anyhow::anyhow!( @@ -87,7 +87,7 @@ impl SvnDownloader { /// The default `VcsDownloader::clean_changes()` behavior: fail if the working copy has /// local changes. fn fail_on_local_changes( - &mut self, + &self, package: PackageInterfaceHandle, path: &str, ) -> anyhow::Result<()> { @@ -120,16 +120,12 @@ impl VcsDownloader for SvnDownloader { &self.inner.filesystem } - fn has_cleaned_changes(&self) -> &IndexMap<String, bool> { + fn has_cleaned_changes(&self) -> &std::cell::RefCell<IndexMap<String, bool>> { &self.inner.has_cleaned_changes } - fn has_cleaned_changes_mut(&mut self) -> &mut IndexMap<String, bool> { - &mut self.inner.has_cleaned_changes - } - async fn do_download( - &mut self, + &self, _package: PackageInterfaceHandle, _path: &str, url: &str, @@ -154,7 +150,7 @@ impl VcsDownloader for SvnDownloader { } async fn do_install( - &mut self, + &self, package: PackageInterfaceHandle, path: &str, url: &str, @@ -173,7 +169,7 @@ impl VcsDownloader for SvnDownloader { .get("svn-cache-credentials") .and_then(|v| v.as_bool()) { - self.cache_credentials = val; + self.cache_credentials.set(val); } } } @@ -200,7 +196,7 @@ impl VcsDownloader for SvnDownloader { } async fn do_update( - &mut self, + &self, _initial: PackageInterfaceHandle, target: PackageInterfaceHandle, path: &str, @@ -251,7 +247,7 @@ impl VcsDownloader for SvnDownloader { } async fn clean_changes( - &mut self, + &self, package: PackageInterfaceHandle, path: &str, update: bool, @@ -359,7 +355,7 @@ impl VcsDownloader for SvnDownloader { } fn get_commit_logs( - &mut self, + &self, from_reference: &str, to_reference: &str, path: &str, @@ -428,7 +424,7 @@ impl VcsDownloader for SvnDownloader { self.inner.config.clone(), Some(self.inner.process.clone()), ); - util.set_cache_credentials(self.cache_credentials); + util.set_cache_credentials(self.cache_credentials.get()); util.execute_local(command.clone(), path, None, self.inner.io.is_verbose()) .map_err(|e| { RuntimeException { @@ -452,7 +448,7 @@ impl VcsDownloader for SvnDownloader { impl ChangeReportInterface for SvnDownloader { fn get_local_changes( - &mut self, + &self, _package: PackageInterfaceHandle, path: &str, ) -> anyhow::Result<Option<String>> { @@ -489,9 +485,7 @@ impl DownloaderInterface for SvnDownloader { <Self as VcsDownloader>::get_installation_source(self) } - fn as_change_report_interface( - &mut self, - ) -> Option<&mut dyn crate::downloader::ChangeReportInterface> { + fn as_change_report_interface(&self) -> Option<&dyn crate::downloader::ChangeReportInterface> { Some(self) } @@ -502,7 +496,7 @@ impl DownloaderInterface for SvnDownloader { } async fn download( - &mut self, + &self, package: PackageInterfaceHandle, path: &str, prev_package: Option<PackageInterfaceHandle>, @@ -512,7 +506,7 @@ impl DownloaderInterface for SvnDownloader { } async fn prepare( - &mut self, + &self, r#type: &str, package: PackageInterfaceHandle, path: &str, @@ -522,7 +516,7 @@ impl DownloaderInterface for SvnDownloader { } async fn install( - &mut self, + &self, package: PackageInterfaceHandle, path: &str, _output: bool, @@ -531,7 +525,7 @@ impl DownloaderInterface for SvnDownloader { } async fn update( - &mut self, + &self, initial: PackageInterfaceHandle, target: PackageInterfaceHandle, path: &str, @@ -540,7 +534,7 @@ impl DownloaderInterface for SvnDownloader { } async fn remove( - &mut self, + &self, package: PackageInterfaceHandle, path: &str, _output: bool, @@ -549,7 +543,7 @@ impl DownloaderInterface for SvnDownloader { } async fn cleanup( - &mut self, + &self, r#type: &str, package: PackageInterfaceHandle, path: &str, |
