aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/repository/vcs')
-rw-r--r--crates/shirabe/src/repository/vcs/fossil_driver.rs2
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs2
-rw-r--r--crates/shirabe/src/repository/vcs/git_driver.rs68
-rw-r--r--crates/shirabe/src/repository/vcs/hg_driver.rs4
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs3
5 files changed, 69 insertions, 10 deletions
diff --git a/crates/shirabe/src/repository/vcs/fossil_driver.rs b/crates/shirabe/src/repository/vcs/fossil_driver.rs
index cd3ae3a..a765c4c 100644
--- a/crates/shirabe/src/repository/vcs/fossil_driver.rs
+++ b/crates/shirabe/src/repository/vcs/fossil_driver.rs
@@ -96,7 +96,7 @@ impl FossilDriver {
pub(crate) fn update_local_repo(&mut self) -> anyhow::Result<()> {
assert!(self.repo_file.is_some());
- let fs = Filesystem::new();
+ let fs = Filesystem::new(None);
fs.ensure_directory_exists(&self.checkout_dir)?;
if !is_writable(&dirname(&self.checkout_dir)) {
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index fb667b7..05e7c61 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -241,7 +241,7 @@ impl GitBitbucketDriver {
if self.inner.should_cache(identifier) {
self.inner.cache.as_ref().unwrap().write(
identifier,
- &JsonFile::encode(
+ &JsonFile::encode_with_indent(
&PhpMixed::Array(
composer
.clone()
diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs
index 40ad179..33474b1 100644
--- a/crates/shirabe/src/repository/vcs/git_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_driver.rs
@@ -69,7 +69,7 @@ impl GitDriver {
GitUtil::clean_env(&self.inner.process);
- let fs = Filesystem::new();
+ let fs = Filesystem::new(None);
fs.ensure_directory_exists(&dirname(&self.repo_dir))?;
if !is_writable(&dirname(&self.repo_dir)) {
@@ -99,7 +99,7 @@ impl GitDriver {
&*self.inner.io,
&self.inner.config,
&self.inner.process,
- &Filesystem::new(),
+ &Filesystem::new(None),
);
if !git_util.sync_mirror(&self.inner.url, &self.repo_dir)? {
if !is_dir(&self.repo_dir) {
@@ -164,7 +164,7 @@ impl GitDriver {
&*self.inner.io,
&self.inner.config,
&self.inner.process,
- &Filesystem::new(),
+ &Filesystem::new(None),
);
if !Filesystem::is_local_path(&self.inner.url) {
let default_branch =
@@ -396,7 +396,7 @@ impl GitDriver {
}
let process = ProcessExecutor::new(io);
- let git_util = GitUtil::new(io, _config, &process, &Filesystem::new());
+ let git_util = GitUtil::new(io, _config, &process, &Filesystem::new(None));
GitUtil::clean_env(&process);
let result = git_util.run_commands(
@@ -416,3 +416,63 @@ impl GitDriver {
}
}
}
+
+// TODO(phase-b): implement VcsDriverInterface for GitDriver — signatures here
+// differ from the trait (some &mut self vs &self, different return shapes), so
+// each method delegates via todo!() until reconciled.
+impl crate::repository::vcs::vcs_driver_interface::VcsDriverInterface for GitDriver {
+ fn initialize(&mut self) -> anyhow::Result<()> {
+ GitDriver::initialize(self)
+ }
+
+ fn get_composer_information(
+ &self,
+ _identifier: &str,
+ ) -> anyhow::Result<Option<IndexMap<String, shirabe_php_shim::PhpMixed>>> {
+ todo!()
+ }
+
+ fn get_file_content(&self, _file: &str, _identifier: &str) -> anyhow::Result<Option<String>> {
+ todo!()
+ }
+
+ fn get_change_date(&self, _identifier: &str) -> anyhow::Result<Option<DateTime<Utc>>> {
+ todo!()
+ }
+
+ fn get_root_identifier(&self) -> anyhow::Result<String> {
+ todo!()
+ }
+
+ fn get_branches(&self) -> anyhow::Result<IndexMap<String, String>> {
+ todo!()
+ }
+
+ fn get_tags(&self) -> anyhow::Result<IndexMap<String, String>> {
+ todo!()
+ }
+
+ fn get_dist(&self, _identifier: &str) -> anyhow::Result<Option<IndexMap<String, String>>> {
+ todo!()
+ }
+
+ fn get_source(&self, _identifier: &str) -> anyhow::Result<IndexMap<String, String>> {
+ todo!()
+ }
+
+ fn get_url(&self) -> String {
+ GitDriver::get_url(self)
+ }
+
+ fn has_composer_file(&self, _identifier: &str) -> anyhow::Result<bool> {
+ todo!()
+ }
+
+ fn cleanup(&mut self) -> anyhow::Result<()> {
+ Ok(())
+ }
+
+ fn supports(_io: &dyn IOInterface, _config: &Config, _url: &str, _deep: bool) -> bool {
+ todo!()
+ }
+}
diff --git a/crates/shirabe/src/repository/vcs/hg_driver.rs b/crates/shirabe/src/repository/vcs/hg_driver.rs
index 55872ae..68393ed 100644
--- a/crates/shirabe/src/repository/vcs/hg_driver.rs
+++ b/crates/shirabe/src/repository/vcs/hg_driver.rs
@@ -45,7 +45,7 @@ impl HgDriver {
Preg::replace(r"{[^a-z0-9]}i", "-", Url::sanitize(self.inner.url.clone()));
self.repo_dir = format!("{}/{}/", cache_vcs_dir, sanitized);
- let fs = Filesystem::new();
+ let fs = Filesystem::new(None);
fs.ensure_directory_exists(&cache_vcs_dir)?;
if !is_writable(&dirname(&self.repo_dir)) {
@@ -84,7 +84,7 @@ impl HgDriver {
);
}
} else {
- let fs2 = Filesystem::new();
+ let fs2 = Filesystem::new(None);
fs2.remove_directory(&self.repo_dir)?;
let repo_dir = self.repo_dir.clone();
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index 0a05d84..2e649df 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -194,7 +194,6 @@ impl SvnDriver {
.map(PhpMixed::from)
.unwrap_or(PhpMixed::Null),
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
- None,
);
self.inner
.cache
@@ -474,7 +473,7 @@ impl SvnDriver {
/// An absolute path (leading '/') is converted to a file:// url.
pub(crate) fn normalize_url(url: &str) -> String {
- let fs = Filesystem::new();
+ let fs = Filesystem::new(None);
if fs.is_absolute_path(url) {
return format!("file://{}", strtr(url, "\\", "/"));
}