pub struct Repo { /* private fields */ }
Expand description
Repo with extra states to support revset queries.
Implementations§
Source§impl Repo
impl Repo
Sourcepub fn open_from_env() -> Result<Self>
pub fn open_from_env() -> Result<Self>
Open an existing repo. Build indexes on demand.
Sourcepub fn open_from_repo(
git_repo: impl AsRef<Repository> + 'static,
) -> Result<Self>
pub fn open_from_repo( git_repo: impl AsRef<Repository> + 'static, ) -> Result<Self>
Open an existing repo previously opened by libgit2. Build commit graph indexes on demand.
Sourcepub fn revs(&self, ast: impl ParseToExpr) -> Result<Set>
pub fn revs(&self, ast: impl ParseToExpr) -> Result<Set>
Evaluate the expression. Return the resulting set. User-defined aliases are ignored.
Sourcepub fn anyrevs(&self, ast: impl ParseToExpr) -> Result<Set>
pub fn anyrevs(&self, ast: impl ParseToExpr) -> Result<Set>
Evaluate the expression. Return the resulting set. User-defined aliases are respected.
To define aliases, add a [revsetalias]
section like:
[revsetalias]
# f(x) can be used, and will be expended to ancestor(x) + x.
f = ancestor($1) + $1
Sourcepub fn revs_with_context(
&self,
ast: impl ParseToExpr,
ctx: &EvalContext,
) -> Result<Set>
pub fn revs_with_context( &self, ast: impl ParseToExpr, ctx: &EvalContext, ) -> Result<Set>
Evaluate the expression with the given context. Return the resulting set.
Sourcepub fn git_repo(&self) -> &Repository
pub fn git_repo(&self) -> &Repository
Obtains read-only git2::Repository
reference.
Sourcepub fn eval_context_from_config(&self) -> Result<&EvalContext>
pub fn eval_context_from_config(&self) -> Result<&EvalContext>
Returns a EvalContext
that contains user-defined alias
in the [revsetalias]
config section.
Auto Trait Implementations§
impl !Freeze for Repo
impl !RefUnwindSafe for Repo
impl !Send for Repo
impl !Sync for Repo
impl Unpin for Repo
impl !UnwindSafe for Repo
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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