From c028a9d5c737de5d2b259638a0a76b999364a262 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 22:40:30 +0900 Subject: feat(vcs): implement VcsDriverInterface for all VCS drivers Reconcile the VcsDriverInterface trait with the concrete drivers so every driver implements it as in PHP, where each driver extends VcsDriver. - Make cache-mutating getters take &mut self in the trait, matching the inherent methods' lazy-cache semantics; update vcs_repository consumers. - Change supports() to take Rc> and return Result, completing GitDriver::supports deep ls-remote and its config wiring. - Add base get_composer_information to Git/Hg/Fossil/Perforce and an impl VcsDriverInterface block to every driver, delegating to inherent methods and absorbing type differences in the impl. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/repository/vcs_repository.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/repository/vcs_repository.rs') diff --git a/crates/shirabe/src/repository/vcs_repository.rs b/crates/shirabe/src/repository/vcs_repository.rs index 9a39b76..e90ac62 100644 --- a/crates/shirabe/src/repository/vcs_repository.rs +++ b/crates/shirabe/src/repository/vcs_repository.rs @@ -416,7 +416,7 @@ impl VcsRepository { } let result: Result<()> = (|| -> Result<()> { - let driver = self.driver.as_ref().unwrap(); + let driver = self.driver.as_mut().unwrap(); let data_opt = driver.get_composer_information(&identifier)?; if data_opt.is_none() { if is_very_verbose { @@ -667,8 +667,11 @@ impl VcsRepository { } let result: Result<()> = (|| -> Result<()> { - let driver = self.driver.as_ref().unwrap(); - let data_opt = driver.get_composer_information(&identifier)?; + let data_opt = self + .driver + .as_mut() + .unwrap() + .get_composer_information(&identifier)?; if data_opt.is_none() { if is_very_verbose { self.io.write_error(&format!( @@ -689,7 +692,7 @@ impl VcsRepository { ); data.shift_remove("default-branch"); - if driver.get_root_identifier()? == branch { + if self.driver.as_mut().unwrap().get_root_identifier()? == branch { data.insert("default-branch".to_string(), PhpMixed::Bool(true)); } @@ -703,6 +706,7 @@ impl VcsRepository { )); } + let driver = self.driver.as_ref().unwrap(); let package_data = self.pre_process(&**driver, data, &identifier)?; let package = self .loader -- cgit v1.3.1