diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-29 00:16:56 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-29 00:23:32 +0900 |
| commit | 7f83e785a77fbdbcada9c6714703d4e5801af82a (patch) | |
| tree | ef7debc5cbc91d521db4dc5a563807c486dafd22 /crates/shirabe/src/repository/vcs | |
| parent | 7715c98aaf3e3962cabbcf740e93fa817a2f8027 (diff) | |
| download | php-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.tar.gz php-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.tar.zst php-shirabe-7f83e785a77fbdbcada9c6714703d4e5801af82a.zip | |
refactor(io): unify IOInterface params to Rc<RefCell<dyn _>>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/vcs')
8 files changed, 35 insertions, 8 deletions
diff --git a/crates/shirabe/src/repository/vcs/forgejo_driver.rs b/crates/shirabe/src/repository/vcs/forgejo_driver.rs index ccd0c16..d5c4a89 100644 --- a/crates/shirabe/src/repository/vcs/forgejo_driver.rs +++ b/crates/shirabe/src/repository/vcs/forgejo_driver.rs @@ -487,7 +487,12 @@ impl ForgejoDriver { } } - pub fn supports(io: &dyn IOInterface, config: &Config, url: &str, _deep: bool) -> bool { + pub fn supports( + io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, + config: &Config, + url: &str, + _deep: bool, + ) -> bool { let forgejo_url = ForgejoUrl::try_from(Some(url)); if forgejo_url.is_none() { return false; diff --git a/crates/shirabe/src/repository/vcs/fossil_driver.rs b/crates/shirabe/src/repository/vcs/fossil_driver.rs index 207a138..1e34f21 100644 --- a/crates/shirabe/src/repository/vcs/fossil_driver.rs +++ b/crates/shirabe/src/repository/vcs/fossil_driver.rs @@ -32,7 +32,7 @@ impl FossilDriver { // Ensure we are allowed to use this URL by config. self.inner.config.borrow_mut().prohibit_url_by_config( &self.inner.url, - Some(&*self.inner.io.borrow()), + Some(self.inner.io.clone()), &indexmap::IndexMap::new(), )?; diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs index 53e49fc..8a0dffd 100644 --- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs @@ -857,7 +857,12 @@ impl GitBitbucketDriver { } /// @inheritDoc - pub fn supports(io: &dyn IOInterface, _config: &Config, url: &str, _deep: bool) -> bool { + pub fn supports( + io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, + _config: &Config, + url: &str, + _deep: bool, + ) -> bool { if !Preg::is_match( r"#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i", url, diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs index 665e2fb..01aa759 100644 --- a/crates/shirabe/src/repository/vcs/git_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_driver.rs @@ -536,7 +536,12 @@ impl crate::repository::vcs::VcsDriverInterface for GitDriver { Ok(()) } - fn supports(_io: &dyn IOInterface, _config: &Config, _url: &str, _deep: bool) -> bool { + fn supports( + _io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, + _config: &Config, + _url: &str, + _deep: bool, + ) -> bool { todo!() } } diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs index 5f8266c..0b9066b 100644 --- a/crates/shirabe/src/repository/vcs/github_driver.rs +++ b/crates/shirabe/src/repository/vcs/github_driver.rs @@ -934,7 +934,12 @@ impl GitHubDriver { Ok(self.branches.clone().unwrap_or_default()) } - pub fn supports(io: &dyn IOInterface, config: &Config, url: &str, _deep: bool) -> bool { + pub fn supports( + io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, + config: &Config, + url: &str, + _deep: bool, + ) -> bool { let mut matches: IndexMap<CaptureKey, String> = IndexMap::new(); if !Preg::is_match_strict_groups3( r"#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#", diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs index e31eb67..e8701bf 100644 --- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs +++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs @@ -979,7 +979,12 @@ impl GitLabDriver { /// Uses the config `gitlab-domains` to see if the driver supports the url for the /// repository given. - pub fn supports(io: &dyn IOInterface, config: &Config, url: &str, _deep: bool) -> bool { + pub fn supports( + io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, + config: &Config, + url: &str, + _deep: bool, + ) -> bool { let mut match_: IndexMap<CaptureKey, String> = IndexMap::new(); if !Preg::is_match_strict_groups3(Self::URL_REGEX, url, Some(&mut match_)).unwrap_or(false) { diff --git a/crates/shirabe/src/repository/vcs/hg_driver.rs b/crates/shirabe/src/repository/vcs/hg_driver.rs index ab3bd0c..9079d71 100644 --- a/crates/shirabe/src/repository/vcs/hg_driver.rs +++ b/crates/shirabe/src/repository/vcs/hg_driver.rs @@ -62,7 +62,7 @@ impl HgDriver { self.inner.config.borrow_mut().prohibit_url_by_config( &self.inner.url, - Some(&*self.inner.io.borrow()), + Some(self.inner.io.clone()), &indexmap::IndexMap::new(), )?; diff --git a/crates/shirabe/src/repository/vcs/vcs_driver_interface.rs b/crates/shirabe/src/repository/vcs/vcs_driver_interface.rs index 7ace36a..c002dc5 100644 --- a/crates/shirabe/src/repository/vcs/vcs_driver_interface.rs +++ b/crates/shirabe/src/repository/vcs/vcs_driver_interface.rs @@ -5,6 +5,8 @@ use crate::io::IOInterface; use chrono::{DateTime, Utc}; use indexmap::IndexMap; use shirabe_php_shim::PhpMixed; +use std::cell::RefCell; +use std::rc::Rc; pub trait VcsDriverInterface: std::fmt::Debug { fn initialize(&mut self) -> anyhow::Result<()>; @@ -34,7 +36,7 @@ pub trait VcsDriverInterface: std::fmt::Debug { fn cleanup(&mut self) -> anyhow::Result<()>; - fn supports(io: &dyn IOInterface, config: &Config, url: &str, deep: bool) -> bool + fn supports(io: Rc<RefCell<dyn IOInterface>>, config: &Config, url: &str, deep: bool) -> bool where Self: Sized; } |
