Skip to main content

GitHistory

Trait GitHistory 

Source
pub trait GitHistory {
    type Error: StdError + Send + Sync + 'static;

    // Required methods
    fn commit_messages(
        &self,
        repository: &Path,
        from: Option<&str>,
        to: &str,
        scope: UnitScope<'_>,
    ) -> Result<Vec<String>, Self::Error>;
    fn equivalent(
        &self,
        repository: &Path,
        base: &str,
        first: &str,
        second: &str,
    ) -> Result<bool, Self::Error>;
    fn has_changes(
        &self,
        repository: &Path,
        from: Option<&str>,
        to: &str,
        scope: UnitScope<'_>,
    ) -> Result<bool, Self::Error>;
    fn is_ancestor(
        &self,
        repository: &Path,
        ancestor: &str,
        descendant: &str,
    ) -> Result<bool, Self::Error>;
    fn resolve(
        &self,
        repository: &Path,
        rev: &str,
    ) -> Result<String, Self::Error>;
    fn tags(
        &self,
        repository: &Path,
        prefix: &str,
    ) -> Result<Vec<String>, Self::Error>;
}
Expand description

Read access to repository history.

Required Associated Types§

Source

type Error: StdError + Send + Sync + 'static

The failure of a history read.

Required Methods§

Source

fn commit_messages( &self, repository: &Path, from: Option<&str>, to: &str, scope: UnitScope<'_>, ) -> Result<Vec<String>, Self::Error>

Messages of the commits after from up to to that change scope, oldest first. Without from the walk reaches the root commit. Merge commits are left out.

Source

fn equivalent( &self, repository: &Path, base: &str, first: &str, second: &str, ) -> Result<bool, Self::Error>

Whether the first-parent chains from base to first and from base to second have the same length and the same trees and messages. A chain that does not reach base is equivalent to nothing.

Source

fn has_changes( &self, repository: &Path, from: Option<&str>, to: &str, scope: UnitScope<'_>, ) -> Result<bool, Self::Error>

Whether scope differs between the commits from and to. Without from the comparison starts from the empty tree.

Source

fn is_ancestor( &self, repository: &Path, ancestor: &str, descendant: &str, ) -> Result<bool, Self::Error>

Whether ancestor is descendant or reachable from it.

Source

fn resolve(&self, repository: &Path, rev: &str) -> Result<String, Self::Error>

The commit a revision expression such as origin/main names.

Source

fn tags( &self, repository: &Path, prefix: &str, ) -> Result<Vec<String>, Self::Error>

List the tag names that start with prefix.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§