aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/hg.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-20 08:33:49 +0900
committernsfisis <nsfisis@gmail.com>2026-05-20 08:33:57 +0900
commitf31b101ce1e921a026ba234b1f0a83b0392bc118 (patch)
treeb7ac2aa84d71ebd162cc21aeab0240e7e0544988 /crates/shirabe/src/util/hg.rs
parent5e31fa33c3b5cf726a57a063b8e7a070869250fe (diff)
downloadphp-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.tar.gz
php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.tar.zst
php-shirabe-f31b101ce1e921a026ba234b1f0a83b0392bc118.zip
fix(compile): fix all remaining compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/hg.rs')
-rw-r--r--crates/shirabe/src/util/hg.rs26
1 files changed, 18 insertions, 8 deletions
diff --git a/crates/shirabe/src/util/hg.rs b/crates/shirabe/src/util/hg.rs
index fa25a78..0d4d36d 100644
--- a/crates/shirabe/src/util/hg.rs
+++ b/crates/shirabe/src/util/hg.rs
@@ -52,12 +52,14 @@ impl Hg {
}
// Try with the authentication information available
- let matches = Preg::is_match_with_captures(
+ let mut matches: indexmap::IndexMap<String, String> = indexmap::IndexMap::new();
+ let matched = Preg::is_match_named(
r"(?i)^(?P<proto>ssh|https?)://(?:(?P<user>[^:@]+)(?::(?P<pass>[^:@]+))?@)?(?P<host>[^/]+)(?P<path>/.*)?",
&url,
+ &mut matches,
)?;
- if let Some(matches) = matches {
+ if matched {
if self
.io
.has_authentication(matches.get("host").map(|s| s.as_str()).unwrap_or(""))
@@ -82,8 +84,16 @@ impl Hg {
format!(
"{}://{}:{}@{}{}",
matches.get("proto").unwrap_or(&String::new()),
- rawurlencode(auth.get("username").map(|s| s.as_str()).unwrap_or("")),
- rawurlencode(auth.get("password").map(|s| s.as_str()).unwrap_or("")),
+ rawurlencode(
+ auth.get("username")
+ .and_then(|s| s.as_deref())
+ .unwrap_or("")
+ ),
+ rawurlencode(
+ auth.get("password")
+ .and_then(|s| s.as_deref())
+ .unwrap_or("")
+ ),
matches.get("host").unwrap_or(&String::new()),
matches.get("path").unwrap_or(&String::new()),
)
@@ -100,7 +110,7 @@ impl Hg {
return Ok(());
}
- let error = self.process.borrow().get_error_output();
+ let error = self.process.borrow().get_error_output().to_string();
return self
.throw_exception(&format!("Failed to clone {}, \n\n{}", url, error), &url);
}
@@ -117,7 +127,7 @@ impl Hg {
if Self::get_version(&self.process).is_none() {
anyhow::bail!(
"{}",
- Url::sanitize(&format!(
+ Url::sanitize(format!(
"Failed to clone {}, hg was not found, check that it is installed and in your PATH env.\n\n{}",
url,
self.process.borrow().get_error_output()
@@ -125,7 +135,7 @@ impl Hg {
);
}
- anyhow::bail!("{}", Url::sanitize(message));
+ anyhow::bail!("{}", Url::sanitize(message.to_string()));
}
pub fn get_version(
@@ -137,7 +147,7 @@ impl Hg {
if process.borrow_mut().execute_args(
&["hg".to_string(), "--version".to_string()],
&mut output,
- None,
+ (),
) == 0
{
if let Ok(Some(matches)) = Preg::is_match_with_indexed_captures(