Struct git_meta::GitRepo [−][src]
Use GitRepo::open()
to read a repo on disk. GitRepo::new()
if you need to clone the repo.
Clone a repo with .git_clone()
or git_clone_shallow()
Fields
url: GitUrl
The remote url of the repo
head: Option<GitCommitMeta>
The current commit. This can be configured prior to clone with with_commit()
credentials: Option<GitCredentials>
The ssh key or user/pass needed to clone for private repo
branch: Option<String>
The name of the remote branch.
This can be configured with a local branch name prior to clone with with_branch()
.
path: Option<PathBuf>
The location of the repo on disk
Implementations
impl GitRepo
[src]
pub fn git_clone<P: AsRef<Path>>(&self, target: P) -> Result<GitRepo>
[src]
pub fn git_clone_shallow<P: AsRef<Path>>(&self, target: P) -> Result<GitRepo>
[src]
impl GitRepo
[src]
pub fn get_remote_name(&self, r: &Repository) -> Result<String>
[src]
Return the remote name from the given git2::Repository
For example, the typical remote name: origin
pub fn get_remote_branch_head_refs(
&self,
branch_filter: Option<Vec<String>>
) -> Result<BranchHeads>
[src]
&self,
branch_filter: Option<Vec<String>>
) -> Result<BranchHeads>
Return a HashMap<String, GitCommitMeta>
for a branch containing
the branch names and the latest commit of the branch. Providing a
branch_filter` will only return branches based on
patterns matching the start of the branch name.
pub fn is_commit_in_branch<'repo>(
r: &'repo Repository,
commit: &Commit<'_>,
branch: &Branch<'_>
) -> bool
[src]
r: &'repo Repository,
commit: &Commit<'_>,
branch: &Branch<'_>
) -> bool
Returns a bool
if a commit exists in the branch using the git2
crate
pub fn get_git2_branch<'repo>(
r: &'repo Repository,
local_branch: &Option<String>
) -> Result<Branch<'repo>>
[src]
r: &'repo Repository,
local_branch: &Option<String>
) -> Result<Branch<'repo>>
Return the git2::Branch
struct for a local repo (as opposed to a remote repo)
If local_branch
is not provided, we'll select the current active branch, based on HEAD
pub fn remote_url_from_repository<'repo>(r: &'repo Repository) -> Result<String>
[src]
Return the remote url from the given Repository
pub fn git_remote_from_path(path: &Path) -> Result<String>
[src]
Returns the remote url after opening and validating repo from the local path
pub fn git_remote_from_repo(local_repo: &Repository) -> Result<String>
[src]
Returns the remote url from the git2::Repository
struct
pub fn list_files_changed<S: AsRef<str>>(
&self,
commit1: S,
commit2: S
) -> Result<Option<Vec<PathBuf>>>
[src]
&self,
commit1: S,
commit2: S
) -> Result<Option<Vec<PathBuf>>>
Returns a Result<Option<Vec<PathBuf>>>
containing files changed between commit1
and commit2
pub fn expand_partial_commit_id<S: AsRef<str>>(
&self,
partial_commit_id: S
) -> Result<String>
[src]
&self,
partial_commit_id: S
) -> Result<String>
Takes in a partial commit SHA-1, and attempts to expand to the full 40-char commit id
pub fn has_path_changed<P: AsRef<Path>>(&self, path: P) -> bool
[src]
Checks the list of files changed between last 2 commits (HEAD
and HEAD~1
).
Returns bool
depending on whether any changes were made in path
.
A path
should be relative to the repo root. Can be a file or a directory.
pub fn has_path_changed_between<P: AsRef<Path>, S: AsRef<str>>(
&self,
path: P,
commit1: S,
commit2: S
) -> bool
[src]
&self,
path: P,
commit1: S,
commit2: S
) -> bool
Checks the list of files changed between 2 commits (commit1
and commit2
).
Returns bool
depending on whether any changes were made in path
.
A path
should be relative to the repo root. Can be a file or a directory.
pub fn new_commits_exist(&self) -> bool
[src]
Check if new commits exist by performing a shallow clone and comparing branch heads
impl GitRepo
[src]
pub fn open(
path: PathBuf,
branch: Option<String>,
commit_id: Option<String>
) -> Result<GitRepo>
[src]
path: PathBuf,
branch: Option<String>,
commit_id: Option<String>
) -> Result<GitRepo>
Returns a GitRepo
after parsing metadata from a repo
- If a local
branch
is not provided, current checked out branch will be used. The provided branch will be resolved to its remote branch name - If
commit_id
is not provided, the current commit (the HEAD ofbranch
) will be used
pub fn with_path(self, path: PathBuf) -> Self
[src]
Set the location of GitRepo
on the filesystem
pub fn with_branch<S: Into<String>>(self, branch: S) -> Self
[src]
Intended to be set with the remote name branch of GitRepo
pub fn with_commit(self, commit: Option<Commit<'_>>) -> Self
[src]
Set the GitCommitMeta
from git2::Commit
pub fn with_credentials(self, creds: Option<GitCredentials>) -> Self
[src]
Set GitCredentials
for private repos.
None
indicates public repo
pub fn new<S: AsRef<str>>(url: S) -> Result<GitRepo>
[src]
Create a new GitRepo
with url
.
Use along with with_*
methods to set other fields of GitRepo
.
Use GitRepoCloner
if you need to clone the repo, and convert back with GitRepo.into()
pub fn to_repository(&self) -> Result<Repository, Error>
[src]
Returns a git2::Repository
from self.path
pub fn is_shallow(&self) -> bool
[src]
Test whether GitRepo
is a shallow clone
Trait Implementations
impl Clone for GitRepo
[src]
impl Debug for GitRepo
[src]
impl Default for GitRepo
[src]
impl From<Repository> for GitRepo
[src]
fn from(repo: Repository) -> Self
[src]
Convert from git2::Repository
to GitRepo
.
impl PartialEq<GitRepo> for GitRepo
[src]
impl StructuralPartialEq for GitRepo
[src]
Auto Trait Implementations
impl RefUnwindSafe for GitRepo
[src]
impl Send for GitRepo
[src]
impl Sync for GitRepo
[src]
impl Unpin for GitRepo
[src]
impl UnwindSafe for GitRepo
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<D> OwoColorize for D
pub fn fg<C>(&'a self) -> FgColorDisplay<'a, C, Self> where
C: Color,
C: Color,
pub fn bg<C>(&'a self) -> BgColorDisplay<'a, C, Self> where
C: Color,
C: Color,
pub fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
pub fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
pub fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
pub fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
pub fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
pub fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
pub fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
pub fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
pub fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
pub fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
pub fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
pub fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
pub fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
pub fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
pub fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
pub fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
pub fn white(&'a self) -> FgColorDisplay<'a, White, Self>
pub fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
pub fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
pub fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
pub fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
pub fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
pub fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
pub fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
pub fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
pub fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
pub fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
pub fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
pub fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
pub fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
pub fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
pub fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
pub fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
pub fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
pub fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
pub fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
pub fn bold(&'a self) -> BoldDisplay<'a, Self>
pub fn dimmed(&'a self) -> DimDisplay<'a, Self>
pub fn italic(&'a self) -> ItalicDisplay<'a, Self>
pub fn underline(&'a self) -> UnderlineDisplay<'a, Self>
pub fn blink(&'a self) -> BlinkDisplay<'a, Self>
pub fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
pub fn reversed(&'a self) -> ReversedDisplay<'a, Self>
pub fn hidden(&'a self) -> HiddenDisplay<'a, Self>
pub fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
pub fn color<Color>(
&'a self,
color: Color
) -> FgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
&'a self,
color: Color
) -> FgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
pub fn on_color<Color>(
&'a self,
color: Color
) -> BgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
&'a self,
color: Color
) -> BgDynColorDisplay<'a, Color, Self> where
Color: DynColor,
pub fn truecolor(
&'a self,
r: u8,
g: u8,
b: u8
) -> FgDynColorDisplay<'a, Rgb, Self>
&'a self,
r: u8,
g: u8,
b: u8
) -> FgDynColorDisplay<'a, Rgb, Self>
pub fn on_truecolor(
&'a self,
r: u8,
g: u8,
b: u8
) -> BgDynColorDisplay<'a, Rgb, Self>
&'a self,
r: u8,
g: u8,
b: u8
) -> BgDynColorDisplay<'a, Rgb, Self>
pub fn style(&self, style: Style) -> Styled<&Self>
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,