From 0080efea9386d46f65d1862fcb90eb44999d9761 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 23 Feb 2026 11:38:42 +0900 Subject: feat(vcs): add mozart-vcs crate for VCS repository support Implement VCS driver/downloader infrastructure mirroring Composer's VCS subsystem. Includes drivers for GitHub, GitLab, Bitbucket, Forgejo, Git, Hg, and SVN with API-based metadata resolution, plus source downloaders for Git/Hg/SVN. Integrates into mozart-registry via vcs_bridge module to scan VCS repositories and feed discovered packages into the SAT resolver. Co-Authored-By: Claude Opus 4.6 --- crates/mozart-vcs/src/util/hg.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 crates/mozart-vcs/src/util/hg.rs (limited to 'crates/mozart-vcs/src/util/hg.rs') diff --git a/crates/mozart-vcs/src/util/hg.rs b/crates/mozart-vcs/src/util/hg.rs new file mode 100644 index 0000000..7f5abcc --- /dev/null +++ b/crates/mozart-vcs/src/util/hg.rs @@ -0,0 +1,30 @@ +use std::path::Path; + +use anyhow::Result; + +use crate::process::{ProcessExecutor, ProcessOutput}; + +/// Mercurial utility for command execution. +pub struct HgUtil { + process: ProcessExecutor, +} + +impl HgUtil { + pub fn new(process: ProcessExecutor) -> Self { + Self { process } + } + + /// Execute a Mercurial command. + pub fn execute(&self, args: &[&str], cwd: Option<&Path>) -> Result { + let mut full_args = vec!["hg"]; + full_args.extend_from_slice(args); + self.process.execute_checked(&full_args, cwd) + } + + /// Execute a Mercurial command, not erroring on non-zero exit. + pub fn execute_unchecked(&self, args: &[&str], cwd: Option<&Path>) -> Result { + let mut full_args = vec!["hg"]; + full_args.extend_from_slice(args); + self.process.execute(&full_args, cwd) + } +} -- cgit v1.3.1