pub trait Vcs {
// Required methods
fn is_repo(&self, root: &Path) -> bool;
fn init_repo(&self, root: &Path) -> Result<(), JoyError>;
fn user_email(&self) -> Result<String, JoyError>;
fn version_tags(&self, root: &Path) -> Result<Vec<String>, JoyError>;
fn latest_version_tag(
&self,
root: &Path,
) -> Result<Option<String>, JoyError>;
fn config_get(&self, root: &Path, key: &str) -> Result<String, JoyError>;
fn config_set(
&self,
root: &Path,
key: &str,
value: &str,
) -> Result<(), JoyError>;
}Expand description
VCS read operations that Joy needs.
Required Methods§
Sourcefn is_repo(&self, root: &Path) -> bool
fn is_repo(&self, root: &Path) -> bool
Check if the given directory is inside a VCS repository.
Sourcefn init_repo(&self, root: &Path) -> Result<(), JoyError>
fn init_repo(&self, root: &Path) -> Result<(), JoyError>
Initialize a new repository at the given path.
Sourcefn user_email(&self) -> Result<String, JoyError>
fn user_email(&self) -> Result<String, JoyError>
Get the current user’s email from VCS config.
List all version tags (e.g. v0.5.0), sorted descending.
Sourcefn latest_version_tag(&self, root: &Path) -> Result<Option<String>, JoyError>
fn latest_version_tag(&self, root: &Path) -> Result<Option<String>, JoyError>
Get the latest reachable version tag, if any.
Sourcefn config_get(&self, root: &Path, key: &str) -> Result<String, JoyError>
fn config_get(&self, root: &Path, key: &str) -> Result<String, JoyError>
Read a per-clone VCS-config value. The semantics are
Git-flavoured (git config --local <key>); other backends
implement on the closest equivalent (jj has jj config, pijul
pijul config).
Sourcefn config_set(
&self,
root: &Path,
key: &str,
value: &str,
) -> Result<(), JoyError>
fn config_set( &self, root: &Path, key: &str, value: &str, ) -> Result<(), JoyError>
Write a per-clone VCS-config value. Same semantics as
Vcs::config_get.