pub struct Repository { /* private fields */ }
repo
only.Expand description
Wrapper for Repository
type from git2.
Implementations§
Source§impl Repository
impl Repository
Sourcepub fn path(&self) -> &PathBuf
pub fn path(&self) -> &PathBuf
Returns the initial path of the repository.
In case of a submodule this is the relative path to the toplevel repository.
Sourcepub fn commits(
&self,
range: Option<&str>,
include_path: Option<Vec<Pattern>>,
exclude_path: Option<Vec<Pattern>>,
topo_order_commits: bool,
) -> Result<Vec<Commit<'_>>>
pub fn commits( &self, range: Option<&str>, include_path: Option<Vec<Pattern>>, exclude_path: Option<Vec<Pattern>>, topo_order_commits: bool, ) -> Result<Vec<Commit<'_>>>
Parses and returns the commits.
Sorts the commits by their time.
Sourcepub fn submodules_range(
&self,
old_commit: Option<Commit<'_>>,
new_commit: Commit<'_>,
) -> Result<Vec<SubmoduleRange>>
pub fn submodules_range( &self, old_commit: Option<Commit<'_>>, new_commit: Commit<'_>, ) -> Result<Vec<SubmoduleRange>>
Returns submodule repositories for a given commit range.
For one or two given commits in this repository, a list of changed submodules is calculated. If only one commit is given, then all submodule commits up to the referenced commit will be included. This is usually the case if a submodule is added to the repository.
For each submodule a SubmoduleRange
object is created
This can then be used to query the submodule’s commits by using
Repository::commits
.
Sourcepub fn current_tag(&self) -> Option<Tag>
pub fn current_tag(&self) -> Option<Tag>
Returns the current tag.
It is the same as running git describe --tags
Sourcepub fn resolve_tag(&self, name: &str) -> Tag
pub fn resolve_tag(&self, name: &str) -> Tag
Returns the tag object of the given name.
If given name doesn’t exist, it still returns Tag
with the given name.
Sourcepub fn find_commit(&self, id: &str) -> Option<Commit<'_>>
pub fn find_commit(&self, id: &str) -> Option<Commit<'_>>
Returns the commit object of the given ID.
Parses and returns a commit-tag map.
It collects lightweight and annotated tags.
Sourcepub fn upstream_remote(&self) -> Result<Remote>
pub fn upstream_remote(&self) -> Result<Remote>
Returns the remote of the upstream repository.
The strategy used here is the following:
Find the branch that HEAD points to, and read the remote configured for that branch returns the remote and the name of the local branch.
Note: HEAD must not be detached.
Auto Trait Implementations§
impl Freeze for Repository
impl RefUnwindSafe for Repository
impl Send for Repository
impl !Sync for Repository
impl Unpin for Repository
impl UnwindSafe for Repository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more