aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-29 00:03:00 +0900
committernsfisis <nsfisis@gmail.com>2026-06-29 00:03:00 +0900
commit9be0f98f71fe8071ab839ac1036b4064ac3172b4 (patch)
tree66a2f4feba752f4761c40449e0827ad74fc9b02c /crates/shirabe/src/repository/vcs
parenta84d531548efa678d4021cea891826e59f8fb462 (diff)
downloadphp-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.tar.gz
php-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.tar.zst
php-shirabe-9be0f98f71fe8071ab839ac1036b4064ac3172b4.zip
chore(lint): ban bare `use anyhow::Result` and fully qualify it
Add a no_banned_use linter that forbids importing anyhow::Result, and update all call sites to reference it via its fully-qualified path so it is never confused with std::result::Result. 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/forgejo_driver.rs23
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs32
-rw-r--r--crates/shirabe/src/repository/vcs/github_driver.rs32
-rw-r--r--crates/shirabe/src/repository/vcs/gitlab_driver.rs37
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs24
5 files changed, 89 insertions, 59 deletions
diff --git a/crates/shirabe/src/repository/vcs/forgejo_driver.rs b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
index 9557847..764a2d2 100644
--- a/crates/shirabe/src/repository/vcs/forgejo_driver.rs
+++ b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
@@ -14,7 +14,6 @@ use crate::util::Forgejo;
use crate::util::ForgejoRepositoryData;
use crate::util::ForgejoUrl;
use crate::util::http::Response;
-use anyhow::Result;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
@@ -49,7 +48,7 @@ impl ForgejoDriver {
}
}
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let forgejo_url = ForgejoUrl::create(&self.inner.url)?;
self.inner.origin_url = forgejo_url.origin_url.clone();
@@ -90,7 +89,11 @@ impl ForgejoDriver {
Ok(())
}
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_file_content(file, identifier);
}
@@ -177,7 +180,7 @@ impl ForgejoDriver {
pub fn get_change_date(
&mut self,
identifier: &str,
- ) -> Result<Option<chrono::DateTime<chrono::FixedOffset>>> {
+ ) -> anyhow::Result<Option<chrono::DateTime<chrono::FixedOffset>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_change_date(identifier);
}
@@ -214,7 +217,7 @@ impl ForgejoDriver {
Ok(Some(date))
}
- pub fn get_root_identifier(&mut self) -> Result<String> {
+ pub fn get_root_identifier(&mut self) -> anyhow::Result<String> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_root_identifier();
}
@@ -227,7 +230,7 @@ impl ForgejoDriver {
.clone())
}
- pub fn get_branches(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_branches();
}
@@ -270,7 +273,7 @@ impl ForgejoDriver {
Ok(self.branches.clone().unwrap_or_default())
}
- pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_tags();
}
@@ -330,7 +333,7 @@ impl ForgejoDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_composer_information(identifier);
}
@@ -526,7 +529,7 @@ impl ForgejoDriver {
Ok(true)
}
- fn setup_git_driver(&mut self, url: &str) -> Result<()> {
+ fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> {
let mut git_driver = GitDriver {
inner: VcsDriverBase::new(
{
@@ -549,7 +552,7 @@ impl ForgejoDriver {
Ok(())
}
- fn fetch_repository_data(&mut self) -> Result<()> {
+ fn fetch_repository_data(&mut self) -> anyhow::Result<()> {
if self.repository_data.is_some() {
return Ok(());
}
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index f28a005..45c0c68 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -13,7 +13,6 @@ use crate::repository::vcs::VcsDriverBase;
use crate::repository::vcs::VcsDriverInterface;
use crate::util::Bitbucket;
use crate::util::http::Response;
-use anyhow::Result;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -84,7 +83,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let mut m: indexmap::IndexMap<CaptureKey, String> = indexmap::IndexMap::new();
if !Preg::is_match3(
r"#^https?://bitbucket\.org/([^/]+)/([^/]+?)(?:\.git|/?)?$#i",
@@ -150,7 +149,7 @@ impl GitBitbucketDriver {
/// sets some parameters which are used in other methods
///
/// @phpstan-impure
- fn get_repo_data(&mut self) -> Result<bool> {
+ fn get_repo_data(&mut self) -> anyhow::Result<bool> {
let resource = format!(
"https://api.bitbucket.org/2.0/repositories/{}/{}?{}",
self.owner.clone(),
@@ -246,7 +245,7 @@ impl GitBitbucketDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_composer_information(identifier);
}
@@ -416,7 +415,11 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_file_content(file, identifier);
}
@@ -444,7 +447,10 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> {
+ pub fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_change_date(identifier);
}
@@ -476,7 +482,7 @@ impl GitBitbucketDriver {
pub fn get_source(&self, identifier: &str) -> IndexMap<String, String> {
if let Some(fallback) = self.fallback_driver.as_ref() {
// TODO(phase-c): PHP getSource is infallible (: array), but the Rust trait made it
- // Result, so the fallback's Result is flattened here. The faithful fix is making the
+ // anyhow::Result, so the fallback's anyhow::Result is flattened here. The faithful fix is making the
// VcsDriverInterface get_source/get_dist infallible across all implementations.
return fallback.get_source(identifier).unwrap_or_default();
}
@@ -514,7 +520,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_tags();
}
@@ -593,7 +599,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_branches(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_branches();
}
@@ -680,7 +686,7 @@ impl GitBitbucketDriver {
&mut self,
url: &str,
fetching_repo_data: bool,
- ) -> Result<Response> {
+ ) -> anyhow::Result<Response> {
match self.inner.get_contents(url) {
Ok(r) => Ok(r),
Err(e) => {
@@ -741,7 +747,7 @@ impl GitBitbucketDriver {
///
/// @return true
/// @throws \RuntimeException
- fn attempt_clone_fallback(&mut self) -> Result<bool> {
+ fn attempt_clone_fallback(&mut self) -> anyhow::Result<bool> {
match self.setup_fallback_driver(&self.generate_ssh_url()) {
Ok(()) => Ok(true),
Err(e) => {
@@ -759,7 +765,7 @@ impl GitBitbucketDriver {
}
}
- fn setup_fallback_driver(&mut self, url: &str) -> Result<()> {
+ fn setup_fallback_driver(&mut self, url: &str) -> anyhow::Result<()> {
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(url.to_string()));
let mut driver = GitDriver::new(
@@ -796,7 +802,7 @@ impl GitBitbucketDriver {
}
/// @inheritDoc
- pub fn get_root_identifier(&mut self) -> Result<String> {
+ pub fn get_root_identifier(&mut self) -> anyhow::Result<String> {
if let Some(fallback) = self.fallback_driver.as_mut() {
return fallback.get_root_identifier();
}
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs
index e8e67ea..d68bf4e 100644
--- a/crates/shirabe/src/repository/vcs/github_driver.rs
+++ b/crates/shirabe/src/repository/vcs/github_driver.rs
@@ -12,7 +12,6 @@ use crate::repository::vcs::GitDriver;
use crate::repository::vcs::VcsDriverBase;
use crate::util::GitHub;
use crate::util::http::Response;
-use anyhow::Result;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -69,7 +68,7 @@ impl GitHubDriver {
}
}
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let mut match_: IndexMap<CaptureKey, String> = IndexMap::new();
if !Preg::is_match3(
r"#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/([^/]+?)(?:\.git|/)?$#",
@@ -177,7 +176,7 @@ impl GitHubDriver {
)
}
- pub fn get_root_identifier(&mut self) -> Result<String> {
+ pub fn get_root_identifier(&mut self) -> anyhow::Result<String> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_root_identifier();
}
@@ -255,7 +254,7 @@ impl GitHubDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_composer_information(identifier);
}
@@ -713,7 +712,11 @@ impl GitHubDriver {
result_mixed
}
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_file_content(file, identifier);
}
@@ -791,7 +794,10 @@ impl GitHubDriver {
Ok(Some(content))
}
- pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> {
+ pub fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_change_date(identifier);
}
@@ -825,7 +831,7 @@ impl GitHubDriver {
Ok(Some(date))
}
- pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_tags();
}
@@ -875,7 +881,7 @@ impl GitHubDriver {
Ok(self.tags.clone().unwrap_or_default())
}
- pub fn get_branches(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_branches();
}
@@ -979,7 +985,7 @@ impl GitHubDriver {
/// Gives back the loaded <github-api>/repos/<owner>/<repo> result
///
/// @return mixed[]|null
- pub fn get_repo_data(&mut self) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ pub fn get_repo_data(&mut self) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
self.fetch_root_identifier()?;
Ok(self.repo_data.clone())
@@ -1004,7 +1010,7 @@ impl GitHubDriver {
&mut self,
url: &str,
fetching_repo_data: bool,
- ) -> Result<Response, TransportException> {
+ ) -> anyhow::Result<Response, TransportException> {
let response_result = self.inner.get_contents(url);
match response_result {
Ok(r) => Ok(r),
@@ -1145,7 +1151,7 @@ impl GitHubDriver {
/// Fetch root identifier from GitHub
///
/// @throws TransportException
- pub(crate) fn fetch_root_identifier(&mut self) -> Result<()> {
+ pub(crate) fn fetch_root_identifier(&mut self) -> anyhow::Result<()> {
if self.repo_data.is_some() {
return Ok(());
}
@@ -1220,7 +1226,7 @@ impl GitHubDriver {
pub(crate) fn attempt_clone_fallback(
&mut self,
e: Option<&TransportException>,
- ) -> Result<bool> {
+ ) -> anyhow::Result<bool> {
if !self.allow_git_fallback {
return Err(RuntimeException {
message: format!(
@@ -1257,7 +1263,7 @@ impl GitHubDriver {
}
}
- pub(crate) fn setup_git_driver(&mut self, url: &str) -> Result<()> {
+ pub(crate) fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> {
if !self.allow_git_fallback {
return Err(RuntimeException {
message: "Fallback to git driver disabled".to_string(),
diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
index 136d0d6..3f66223 100644
--- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs
+++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
@@ -13,7 +13,6 @@ use crate::repository::vcs::VcsDriverBase;
use crate::util::GitLab;
use crate::util::HttpDownloader;
use crate::util::http::Response;
-use anyhow::Result;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -80,7 +79,7 @@ impl GitLabDriver {
/// Extracts information from the repository url.
///
/// SSH urls use https by default. Set "secure-http": false on the repository config to use http instead.
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let mut match_: IndexMap<CaptureKey, String> = IndexMap::new();
if !Preg::is_match3(Self::URL_REGEX, &self.inner.url, Some(&mut match_)) {
return Err(InvalidArgumentException {
@@ -262,7 +261,7 @@ impl GitLabDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_composer_information(identifier);
}
@@ -416,7 +415,11 @@ impl GitLabDriver {
.unwrap_or(None))
}
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_file_content(file, identifier);
}
@@ -451,7 +454,10 @@ impl GitLabDriver {
Ok(content)
}
- pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> {
+ pub fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_change_date(identifier);
}
@@ -546,7 +552,7 @@ impl GitLabDriver {
result
}
- pub fn get_root_identifier(&mut self) -> Result<String> {
+ pub fn get_root_identifier(&mut self) -> anyhow::Result<String> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_root_identifier();
}
@@ -560,7 +566,7 @@ impl GitLabDriver {
.to_string())
}
- pub fn get_branches(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_branches();
}
@@ -572,7 +578,7 @@ impl GitLabDriver {
Ok(self.branches.clone().unwrap_or_default())
}
- pub fn get_tags(&mut self) -> Result<IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
if let Some(ref mut git_driver) = self.git_driver {
return git_driver.get_tags();
}
@@ -621,7 +627,10 @@ impl GitLabDriver {
}
/// @return string[] where keys are named references like tags or branches and the value a sha
- pub(crate) fn get_references(&mut self, r#type: &str) -> Result<IndexMap<String, String>> {
+ pub(crate) fn get_references(
+ &mut self,
+ r#type: &str,
+ ) -> anyhow::Result<IndexMap<String, String>> {
let per_page = 100;
let mut resource: Option<String> = Some(format!(
"{}/repository/{}?per_page={}",
@@ -684,7 +693,7 @@ impl GitLabDriver {
Ok(references)
}
- pub(crate) fn fetch_project(&mut self) -> Result<()> {
+ pub(crate) fn fetch_project(&mut self) -> anyhow::Result<()> {
if self.project.is_some() {
return Ok(());
}
@@ -718,7 +727,7 @@ impl GitLabDriver {
///
/// @return true
/// @throws \RuntimeException
- pub(crate) fn attempt_clone_fallback(&mut self) -> Result<bool> {
+ pub(crate) fn attempt_clone_fallback(&mut self) -> anyhow::Result<bool> {
let url = if !self.is_private {
self.generate_public_url()
} else {
@@ -768,7 +777,7 @@ impl GitLabDriver {
)
}
- pub(crate) fn setup_git_driver(&mut self, url: &str) -> Result<()> {
+ pub(crate) fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> {
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(url.to_string()));
let mut git_driver = GitDriver::new(
@@ -787,7 +796,7 @@ impl GitLabDriver {
&mut self,
url: &str,
fetching_repo_data: bool,
- ) -> Result<Response, TransportException> {
+ ) -> anyhow::Result<Response, TransportException> {
let response_result = self.inner.get_contents(url);
match response_result {
Ok(response) => {
@@ -1027,7 +1036,7 @@ impl GitLabDriver {
/// Gives back the loaded <gitlab-api>/projects/<owner>/<repo> result
///
/// @return mixed[]|null
- pub fn get_repo_data(&mut self) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ pub fn get_repo_data(&mut self) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
self.fetch_project()?;
Ok(self.project.clone())
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index cb4ff87..7df7f02 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -11,7 +11,6 @@ use crate::util::Filesystem;
use crate::util::ProcessExecutor;
use crate::util::Svn as SvnUtil;
use crate::util::Url;
-use anyhow::Result;
use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
@@ -68,7 +67,7 @@ impl SvnDriver {
}
}
- pub fn initialize(&mut self) -> Result<()> {
+ pub fn initialize(&mut self) -> anyhow::Result<()> {
let normalized = Self::normalize_url(&self.inner.url);
self.inner.url = normalized.trim_end_matches('/').to_string();
self.base_url = self.inner.url.clone();
@@ -164,7 +163,7 @@ impl SvnDriver {
pub fn get_composer_information(
&mut self,
identifier: &str,
- ) -> Result<Option<IndexMap<String, PhpMixed>>> {
+ ) -> anyhow::Result<Option<IndexMap<String, PhpMixed>>> {
if !self.inner.info_cache.contains_key(identifier) {
if self.should_cache(identifier)
&& let Some(mut res) = self
@@ -255,7 +254,11 @@ impl SvnDriver {
Ok(cached)
}
- pub fn get_file_content(&mut self, file: &str, identifier: &str) -> Result<Option<String>> {
+ pub fn get_file_content(
+ &mut self,
+ file: &str,
+ identifier: &str,
+ ) -> anyhow::Result<Option<String>> {
let identifier = format!("/{}/", trim(identifier, Some("/")));
let (path, rev) = if let Some(m) =
@@ -292,7 +295,10 @@ impl SvnDriver {
Ok(Some(output))
}
- pub fn get_change_date(&mut self, identifier: &str) -> Result<Option<DateTime<FixedOffset>>> {
+ pub fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
let identifier = format!("/{}/", trim(identifier, Some("/")));
let (path, rev) = if let Some(m) =
@@ -329,7 +335,7 @@ impl SvnDriver {
Ok(None)
}
- pub fn get_tags(&mut self) -> Result<&IndexMap<String, String>> {
+ pub fn get_tags(&mut self) -> anyhow::Result<&IndexMap<String, String>> {
if self.tags.is_none() {
let mut tags: IndexMap<String, String> = IndexMap::new();
@@ -373,7 +379,7 @@ impl SvnDriver {
Ok(self.tags.as_ref().unwrap())
}
- pub fn get_branches(&mut self) -> Result<&IndexMap<String, String>> {
+ pub fn get_branches(&mut self) -> anyhow::Result<&IndexMap<String, String>> {
if self.branches.is_none() {
let mut branches: IndexMap<String, String> = IndexMap::new();
@@ -464,7 +470,7 @@ impl SvnDriver {
_config: std::rc::Rc<std::cell::RefCell<Config>>,
url: &str,
deep: bool,
- ) -> Result<bool> {
+ ) -> anyhow::Result<bool> {
let url = Self::normalize_url(url);
if Preg::is_match(r"#(^svn://|^svn\+ssh://|svn\.)#i", &url) {
return Ok(true);
@@ -527,7 +533,7 @@ impl SvnDriver {
/// @param non-empty-list<string> $command The svn command to run.
/// @param string $url The SVN URL.
/// @throws \RuntimeException
- pub(crate) fn execute(&mut self, command: Vec<String>, url: &str) -> Result<String> {
+ pub(crate) fn execute(&mut self, command: Vec<String>, url: &str) -> anyhow::Result<String> {
if self.util.is_none() {
self.util = Some(SvnUtil::new(
self.base_url.clone(),