Skip to main content

GitAdapter

Struct GitAdapter 

Source
pub struct GitAdapter { /* private fields */ }
Expand description

Git adapter implementation

Implementations§

Source§

impl GitAdapter

Source

pub fn open(config: GitAdapterConfig) -> Result<Self, ScmError>

Open a Git repository at the given path or current directory

§Errors

Returns ScmError if the repository cannot be discovered or opened

Source

pub fn repository(&self) -> Arc<Mutex<Repository>>

Get the underlying git2 repository

Source

pub fn repo_root(&self) -> PathBuf

Get the repository root path

Trait Implementations§

Source§

impl SourceControl for GitAdapter

Source§

fn name(&self) -> &'static str

Get the name of this SCM (e.g., “git”)
Source§

fn get_commits_since<'life0, 'life1, 'async_trait>( &'life0 self, tag: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Commit>, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get commits since a specific tag/ref Read more
Source§

fn get_last_tag<'life0, 'life1, 'async_trait>( &'life0 self, pattern: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the last tag matching a pattern Read more
Source§

fn create_tag<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, name: &'life1 str, message: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a new tag Read more
Source§

fn delete_tag<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a tag Read more
Source§

fn get_current_commit<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get current commit hash Read more
Source§

fn get_current_branch<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get current branch name Read more
Source§

fn get_working_tree_status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<WorkingTreeStatus, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if working tree is clean Read more
Source§

fn commit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, message: &'life1 str, files: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<String, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a commit with staged changes Read more
Source§

fn stage_files<'life0, 'life1, 'async_trait>( &'life0 self, files: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<(), ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stage files for commit Read more
Source§

fn push<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, remote: Option<&'life1 str>, branch: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<(), ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Push to remote Read more
Source§

fn repository_root(&self) -> Option<&Path>

Get repository root path
Source§

fn is_on_branch<'life0, 'life1, 'async_trait>( &'life0 self, branch: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if we’re on a specific branch
Source§

fn get_tags_for_commit<'life0, 'life1, 'async_trait>( &'life0 self, commit_hash: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get tags for a specific commit Read more
Source§

fn get_remote_url<'life0, 'life1, 'async_trait>( &'life0 self, remote: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, ScmError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get remote URL Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.