Skip to main content

VcsProvider

Trait VcsProvider 

Source
pub trait VcsProvider {
    // Required methods
    fn working_tree_changes(
        &self,
        base_ref: Option<&str>,
    ) -> Result<Vec<VcsFileChange>, DiffError>;
    fn changes_between_refs(
        &self,
        from_ref: &str,
        to_ref: &str,
    ) -> Result<Vec<VcsFileChange>, DiffError>;
    fn read_file_at_ref(
        &self,
        path: &str,
        git_ref: &str,
    ) -> Result<Option<String>, DiffError>;
    fn commit_count(
        &self,
        from_ref: &str,
        to_ref: &str,
    ) -> Result<usize, DiffError>;
    fn resolve_ref(&self, refspec: &str) -> Result<bool, DiffError>;
    fn head_sha(&self) -> Result<String, DiffError>;
    fn root_commit_sha(&self) -> Result<Option<String>, DiffError>;
}
Expand description

Abstraction over VCS operations needed by the diff module.

Required Methods§

Source

fn working_tree_changes( &self, base_ref: Option<&str>, ) -> Result<Vec<VcsFileChange>, DiffError>

Get changed files between working tree and a base ref.

Source

fn changes_between_refs( &self, from_ref: &str, to_ref: &str, ) -> Result<Vec<VcsFileChange>, DiffError>

Get changed files between two refs (from_ref..to_ref).

Source

fn read_file_at_ref( &self, path: &str, git_ref: &str, ) -> Result<Option<String>, DiffError>

Read file content at a specific ref. Returns None if file doesn’t exist or is binary.

Source

fn commit_count(&self, from_ref: &str, to_ref: &str) -> Result<usize, DiffError>

Count commits between two refs.

Source

fn resolve_ref(&self, refspec: &str) -> Result<bool, DiffError>

Check if a ref exists.

Source

fn head_sha(&self) -> Result<String, DiffError>

Get HEAD commit SHA.

Source

fn root_commit_sha(&self) -> Result<Option<String>, DiffError>

Find the root commit SHA (first commit with no parents).

Implementors§