aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-25 16:44:29 +0900
committernsfisis <nsfisis@gmail.com>2026-06-26 00:20:05 +0900
commitf5f429dbae0a3e2d8224c0b1e4edcef54805d286 (patch)
tree9f837baeeae6efa0ed926b181b8c273128d86c49 /crates/shirabe/src/repository/vcs
parent3a0d9340810a8808d963135a884f50d08442ac67 (diff)
downloadphp-shirabe-f5f429dbae0a3e2d8224c0b1e4edcef54805d286.tar.gz
php-shirabe-f5f429dbae0a3e2d8224c0b1e4edcef54805d286.tar.zst
php-shirabe-f5f429dbae0a3e2d8224c0b1e4edcef54805d286.zip
feat(http): reimplement CurlDownloader on reqwest; port 15 more tests
Replace the libcurl-shim CurlDownloader with a reqwest+tokio implementation per the .ken sketch, resolving the construction panic that blocked command tests (mock path via __new_mock is untouched). Port remote_filesystem (7), hg/svn driver (4), zip_archiver/git_exclude_filter (4) tests. Fix hg/svn/git_exclude regex-delimiter and svn result-propagation porting bugs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/vcs')
-rw-r--r--crates/shirabe/src/repository/vcs/hg_driver.rs6
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs46
2 files changed, 23 insertions, 29 deletions
diff --git a/crates/shirabe/src/repository/vcs/hg_driver.rs b/crates/shirabe/src/repository/vcs/hg_driver.rs
index 3ae87d1..641e3e8 100644
--- a/crates/shirabe/src/repository/vcs/hg_driver.rs
+++ b/crates/shirabe/src/repository/vcs/hg_driver.rs
@@ -243,7 +243,7 @@ impl HgDriver {
for tag in self.inner.process.borrow().split_lines(&output) {
if !tag.is_empty() {
let mut m: IndexMap<CaptureKey, String> = IndexMap::new();
- if Preg::match3(r"^([^\s]+)\s+\d+:(.*)$", &tag, Some(&mut m)) {
+ if Preg::match3(r"(^([^\s]+)\s+\d+:(.*)$)", &tag, Some(&mut m)) {
tags.insert(
m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default(),
m.get(&CaptureKey::ByIndex(2)).cloned().unwrap_or_default(),
@@ -273,7 +273,7 @@ impl HgDriver {
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty() {
let mut m: IndexMap<CaptureKey, String> = IndexMap::new();
- if Preg::match3(r"^([^\s]+)\s+\d+:([a-f0-9]+)", &branch, Some(&mut m)) {
+ if Preg::match3(r"(^([^\s]+)\s+\d+:([a-f0-9]+))", &branch, Some(&mut m)) {
let name = m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default();
if !name.starts_with('-') {
branches.insert(
@@ -294,7 +294,7 @@ impl HgDriver {
for branch in self.inner.process.borrow().split_lines(&output) {
if !branch.is_empty() {
let mut m: IndexMap<CaptureKey, String> = IndexMap::new();
- if Preg::match3(r"^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$", &branch, Some(&mut m)) {
+ if Preg::match3(r"(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)", &branch, Some(&mut m)) {
let name = m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default();
if !name.starts_with('-') {
bookmarks.insert(
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index 19aec03..dd2d26d 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -132,8 +132,8 @@ impl SvnDriver {
.unwrap_or(false),
);
- self.get_branches();
- self.get_tags();
+ self.get_branches()?;
+ self.get_tags()?;
Ok(())
}
@@ -332,18 +332,16 @@ impl SvnDriver {
Ok(None)
}
- pub fn get_tags(&mut self) -> &IndexMap<String, String> {
+ pub fn get_tags(&mut self) -> Result<&IndexMap<String, String>> {
if self.tags.is_none() {
let mut tags: IndexMap<String, String> = IndexMap::new();
// PHP: if ($this->tagsPath !== false) — tagsPath is "string"; treat empty string as false
if !self.tags_path.is_empty() {
- let output = self
- .execute(
- vec!["svn".to_string(), "ls".to_string(), "--verbose".to_string()],
- &format!("{}/{}", self.base_url, self.tags_path),
- )
- .unwrap_or_default();
+ let output = self.execute(
+ vec!["svn".to_string(), "ls".to_string(), "--verbose".to_string()],
+ &format!("{}/{}", self.base_url, self.tags_path),
+ )?;
if !output.is_empty() {
let mut last_rev: i64 = 0;
for line in self.inner.process.borrow().split_lines(&output) {
@@ -375,10 +373,10 @@ impl SvnDriver {
self.tags = Some(tags);
}
- self.tags.as_ref().unwrap()
+ Ok(self.tags.as_ref().unwrap())
}
- pub fn get_branches(&mut self) -> &IndexMap<String, String> {
+ pub fn get_branches(&mut self) -> Result<&IndexMap<String, String>> {
if self.branches.is_none() {
let mut branches: IndexMap<String, String> = IndexMap::new();
@@ -388,12 +386,10 @@ impl SvnDriver {
format!("{}/{}", self.base_url, self.trunk_path.as_ref().unwrap())
};
- let output = self
- .execute(
- vec!["svn".to_string(), "ls".to_string(), "--verbose".to_string()],
- &trunk_parent,
- )
- .unwrap_or_default();
+ let output = self.execute(
+ vec!["svn".to_string(), "ls".to_string(), "--verbose".to_string()],
+ &trunk_parent,
+ )?;
if !output.is_empty() {
for line in self.inner.process.borrow().split_lines(&output) {
let line = trim(&line, None);
@@ -422,12 +418,10 @@ impl SvnDriver {
// PHP: if ($this->branchesPath !== false) — branchesPath is "string"; treat empty string as false
if !self.branches_path.is_empty() {
- let output = self
- .execute(
- vec!["svn".to_string(), "ls".to_string(), "--verbose".to_string()],
- &format!("{}/{}", self.base_url, self.branches_path),
- )
- .unwrap_or_default();
+ let output = self.execute(
+ vec!["svn".to_string(), "ls".to_string(), "--verbose".to_string()],
+ &format!("{}/{}", self.base_url, self.branches_path),
+ )?;
if !output.is_empty() {
let mut last_rev: i64 = 0;
for line in self
@@ -465,7 +459,7 @@ impl SvnDriver {
self.branches = Some(branches);
}
- self.branches.as_ref().unwrap()
+ Ok(self.branches.as_ref().unwrap())
}
pub fn supports(
@@ -624,11 +618,11 @@ impl crate::repository::vcs::VcsDriverInterface for SvnDriver {
}
fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
- Ok(self.get_branches().clone())
+ Ok(self.get_branches()?.clone())
}
fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
- Ok(self.get_tags().clone())
+ Ok(self.get_tags()?.clone())
}
fn get_dist(&self, identifier: &str) -> anyhow::Result<Option<IndexMap<String, String>>> {