Skip to main content

Vcs

Trait Vcs 

Source
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§

Source

fn is_repo(&self, root: &Path) -> bool

Check if the given directory is inside a VCS repository.

Source

fn init_repo(&self, root: &Path) -> Result<(), JoyError>

Initialize a new repository at the given path.

Source

fn user_email(&self) -> Result<String, JoyError>

Get the current user’s email from VCS config.

Source

fn version_tags(&self, root: &Path) -> Result<Vec<String>, JoyError>

List all version tags (e.g. v0.5.0), sorted descending.

Source

fn latest_version_tag(&self, root: &Path) -> Result<Option<String>, JoyError>

Get the latest reachable version tag, if any.

Source

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).

Source

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.

Implementors§