aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-vcs/src/downloader/svn.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-10 00:32:08 +0900
committernsfisis <nsfisis@gmail.com>2026-05-10 00:32:08 +0900
commit8cc1ba8a02c0318b65658f1634de378c780392b9 (patch)
treefdd5cb61e488018891a486b25991b87c84220bb8 /crates/mozart-vcs/src/downloader/svn.rs
parent72b2e877c01e67ba7edd37e34ac2eadb7a1c62c4 (diff)
downloadphp-mozart-8cc1ba8a02c0318b65658f1634de378c780392b9.tar.gz
php-mozart-8cc1ba8a02c0318b65658f1634de378c780392b9.tar.zst
php-mozart-8cc1ba8a02c0318b65658f1634de378c780392b9.zip
refactor(workspace): consolidate crates into mozart-core
Merged mozart-archiver, mozart-autoload, mozart-registry, mozart-sat-resolver, and mozart-vcs into mozart-core to align the source layout with Composer's structure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-vcs/src/downloader/svn.rs')
-rw-r--r--crates/mozart-vcs/src/downloader/svn.rs87
1 files changed, 0 insertions, 87 deletions
diff --git a/crates/mozart-vcs/src/downloader/svn.rs b/crates/mozart-vcs/src/downloader/svn.rs
deleted file mode 100644
index 87b59da..0000000
--- a/crates/mozart-vcs/src/downloader/svn.rs
+++ /dev/null
@@ -1,87 +0,0 @@
-use std::path::Path;
-use std::sync::LazyLock;
-
-use anyhow::Result;
-use regex::Regex;
-
-use crate::util::svn::SvnUtil;
-
-use super::VcsDownloader;
-
-/// Match any non-`X` status line (mirror of Composer's
-/// `{^ *[^X ] +}m`). Ignores externals (`X` prefix).
-static SVN_STATUS_RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"(?m)^ *[^X ] +").unwrap());
-
-/// SVN downloader using checkout/switch.
-pub struct SvnDownloader {
- svn_util: SvnUtil,
-}
-
-impl SvnDownloader {
- pub fn new(svn_util: SvnUtil) -> Self {
- Self { svn_util }
- }
-}
-
-impl VcsDownloader for SvnDownloader {
- fn download(&self, _url: &str, _reference: &str, _target: &Path) -> Result<()> {
- // SVN doesn't need a pre-download step
- Ok(())
- }
-
- fn install(&self, url: &str, reference: &str, target: &Path) -> Result<()> {
- let target_str = target.to_string_lossy().to_string();
- let svn_url = format!("{url}@{reference}");
- self.svn_util
- .execute(&["checkout", &svn_url, &target_str], None)?;
- Ok(())
- }
-
- fn update(&self, url: &str, _old_ref: &str, new_ref: &str, target: &Path) -> Result<()> {
- let svn_url = format!("{url}@{new_ref}");
- self.svn_util
- .execute(&["switch", "--ignore-ancestry", &svn_url], Some(target))?;
- Ok(())
- }
-
- fn remove(&self, target: &Path) -> Result<()> {
- if target.exists() {
- std::fs::remove_dir_all(target)?;
- }
- Ok(())
- }
-
- fn get_local_changes(&self, target: &Path) -> Result<Option<String>> {
- if !target.join(".svn").is_dir() {
- return Ok(None);
- }
- let output = self
- .svn_util
- .execute(&["status", "--ignore-externals"], Some(target))?;
- if SVN_STATUS_RE.is_match(&output.stdout) {
- Ok(Some(output.stdout))
- } else {
- Ok(None)
- }
- }
-
- fn commit_logs(&self, from: &str, to: &str, target: &Path) -> Result<String> {
- let range = format!("{from}:{to}");
- let output = self
- .svn_util
- .execute(&["log", "-r", &range], Some(target))?;
- Ok(output.stdout)
- }
-
- fn is_change_report(&self) -> bool {
- true
- }
-
- fn is_vcs_capable_downloader(&self) -> bool {
- true
- }
-
- fn is_dvcs_downloader(&self) -> bool {
- false
- }
-}