Skip to main content

GitRepository

Trait GitRepository 

Source
pub trait GitRepository: Send + Sync {
    // Required methods
    fn latest_tag(&self, prefix: &str) -> Result<Option<TagInfo>, ReleaseError>;
    fn commits_since(
        &self,
        from: Option<&str>,
    ) -> Result<Vec<Commit>, ReleaseError>;
    fn create_tag(&self, name: &str, message: &str) -> Result<(), ReleaseError>;
    fn push_tag(&self, name: &str) -> Result<(), ReleaseError>;
    fn stage_and_commit(
        &self,
        paths: &[&str],
        message: &str,
    ) -> Result<bool, ReleaseError>;
    fn push(&self) -> Result<(), ReleaseError>;
    fn tag_exists(&self, name: &str) -> Result<bool, ReleaseError>;
    fn remote_tag_exists(&self, name: &str) -> Result<bool, ReleaseError>;
    fn all_tags(&self, prefix: &str) -> Result<Vec<TagInfo>, ReleaseError>;
    fn commits_between(
        &self,
        from: Option<&str>,
        to: &str,
    ) -> Result<Vec<Commit>, ReleaseError>;
    fn tag_date(&self, tag_name: &str) -> Result<String, ReleaseError>;
}
Expand description

Abstraction over git operations.

Required Methods§

Source

fn latest_tag(&self, prefix: &str) -> Result<Option<TagInfo>, ReleaseError>

Find the latest semver tag matching the configured prefix.

Source

fn commits_since(&self, from: Option<&str>) -> Result<Vec<Commit>, ReleaseError>

List commits between a starting point (exclusive) and HEAD (inclusive). If from is None, returns all commits reachable from HEAD.

Source

fn create_tag(&self, name: &str, message: &str) -> Result<(), ReleaseError>

Create an annotated tag at HEAD.

Source

fn push_tag(&self, name: &str) -> Result<(), ReleaseError>

Push a tag to the remote.

Source

fn stage_and_commit( &self, paths: &[&str], message: &str, ) -> Result<bool, ReleaseError>

Stage files and commit. Returns Ok(false) if nothing to commit.

Source

fn push(&self) -> Result<(), ReleaseError>

Push current branch to origin.

Source

fn tag_exists(&self, name: &str) -> Result<bool, ReleaseError>

Check if a tag exists locally.

Source

fn remote_tag_exists(&self, name: &str) -> Result<bool, ReleaseError>

Check if a tag exists on the remote.

Source

fn all_tags(&self, prefix: &str) -> Result<Vec<TagInfo>, ReleaseError>

List all semver tags matching prefix, sorted by version ascending.

Source

fn commits_between( &self, from: Option<&str>, to: &str, ) -> Result<Vec<Commit>, ReleaseError>

List commits between two refs (exclusive from, inclusive to). If from is None, returns all commits reachable from to.

Source

fn tag_date(&self, tag_name: &str) -> Result<String, ReleaseError>

Get the date (YYYY-MM-DD) of the commit a tag points to.

Implementors§