Skip to main content

Repo

Struct Repo 

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

Repository facade that combines embedded and CLI capabilities.

Trait Implementations§

Source§

impl Blamer for Repo

Source§

fn blame( &self, revision: &str, path: &str, opts: Option<&BlameOptions>, ) -> AppResult<Vec<BlameLine>>

Returns per-line blame information for a file at the given revision.
Source§

impl CheckoutManager for Repo

Source§

fn checkout( &self, ref_name: &str, opts: Option<&CheckoutOptions>, ) -> AppResult<()>

Checks out the given ref.
Source§

fn checkout_files(&self, paths: &[&str]) -> AppResult<()>

Checks out the provided paths from the index or HEAD.
Source§

impl CherryPicker for Repo

Source§

fn cherry_pick( &self, commit: &str, opts: Option<&CherryPickOptions>, ) -> AppResult<Oid>

Cherry-picks the given commit.
Source§

fn cherry_pick_continue(&self) -> AppResult<Oid>

Continues an in-progress cherry-pick.
Source§

fn cherry_pick_abort(&self) -> AppResult<()>

Aborts an in-progress cherry-pick.
Source§

impl Committer for Repo

Source§

fn commit(&self, message: &str, opts: Option<&CommitOptions>) -> AppResult<Oid>

Creates a commit from the current index state and returns its object ID.
Source§

impl ConfigReader for Repo

Source§

fn config_get(&self, key: &str) -> AppResult<String>

Returns the highest-precedence value for a config key.
Source§

fn config_get_all(&self, key: &str) -> AppResult<Vec<String>>

Returns all configured values for a multivar config key.
Source§

fn config_set(&self, key: &str, value: &str) -> AppResult<()>

Sets a config key in the repository configuration.
Source§

impl Differ for Repo

Source§

fn diff(&self, from: &str, to: &str) -> AppResult<Vec<DiffEntry>>

Returns file changes between two refs.
Source§

fn diff_stats(&self, from: &str, to: &str) -> AppResult<DiffStats>

Returns aggregated statistics for changes between two refs.
Source§

fn status(&self) -> AppResult<Vec<StatusEntry>>

Returns the working tree status.
Source§

impl Executor for Repo

Source§

fn exec(&self, args: &[&str]) -> AppResult<Vec<u8>>

Executes the git CLI with the provided arguments.
Source§

impl IgnoreReader for Repo

Source§

fn is_ignored(&self, path: &str) -> AppResult<bool>

Reports whether a repository-relative path is ignored by Git. Read more
Source§

impl IndexManager for Repo

Source§

fn stage(&self, paths: &[&str]) -> AppResult<()>

Stages the provided repository-relative paths.
Source§

fn unstage(&self, paths: &[&str]) -> AppResult<()>

Removes the provided repository-relative paths from the index.
Source§

fn staged_entries(&self) -> AppResult<Vec<StatusEntry>>

Lists entries that currently differ between HEAD and the index.
Source§

impl IndexReader for Repo

Source§

fn index_entry(&self, path: &str) -> AppResult<Option<IndexEntry>>

Returns the index entry for path, if the path is present in the index.
Source§

impl Inspector for Repo

Source§

fn describe(&self, opts: Option<&DescribeOptions>) -> AppResult<String>

Describes the current revision in a human-readable form.
Source§

fn rev_parse(&self, revision: &str) -> AppResult<Oid>

Resolves a revision expression to an object ID.
Source§

fn grep( &self, pattern: &str, revision: &str, opts: Option<&GrepOptions>, ) -> AppResult<Vec<GrepMatch>>

Searches tracked content for pattern matches.
Source§

fn show(&self, object: &str) -> AppResult<Vec<u8>>

Returns raw object content for a revision expression.
Source§

impl LogReader for Repo

Source§

fn log(&self, opts: Option<&LogOptions>) -> AppResult<Vec<Commit>>

Returns commits reachable from HEAD, filtered by the provided options.
Source§

fn merge_base(&self, a: &str, b: &str) -> AppResult<Oid>

Returns the merge base between two revisions.
Source§

fn is_ancestor(&self, ancestor: &str, descendant: &str) -> AppResult<bool>

Reports whether ancestor is an ancestor of descendant.
Source§

impl Maintainer for Repo

Source§

fn gc(&self) -> AppResult<()>

Runs repository garbage collection.
Source§

fn prune(&self) -> AppResult<()>

Prunes unreachable objects.
Source§

fn fsck(&self) -> AppResult<()>

Verifies repository object integrity.
Source§

fn clean(&self, opts: Option<&CleanOptions>) -> AppResult<Vec<String>>

Cleans untracked files according to the provided options.
Source§

impl Merger for Repo

Source§

fn merge( &self, branch: &str, opts: Option<&MergeOptions>, ) -> AppResult<MergeResult>

Merges a branch into the current HEAD.
Source§

fn abort_merge(&self) -> AppResult<()>

Aborts an in-progress merge.
Source§

fn merge_abort(&self) -> AppResult<()>

Aborts an in-progress merge.
Source§

impl Rebaser for Repo

Source§

fn rebase( &self, onto: &str, opts: Option<&RebaseOptions>, ) -> AppResult<RebaseResult>

Rebases the current branch onto another target.
Source§

fn abort_rebase(&self) -> AppResult<()>

Aborts an in-progress rebase.
Source§

fn continue_rebase(&self) -> AppResult<RebaseResult>

Continues an in-progress rebase.
Source§

fn rebase_abort(&self) -> AppResult<()>

Aborts an in-progress rebase.
Source§

fn rebase_continue(&self) -> AppResult<RebaseResult>

Continues an in-progress rebase.
Source§

impl RefManager for Repo

Source§

fn list_branches(&self, filter: BranchFilter) -> AppResult<Vec<Branch>>

Lists branches matching the requested filter.
Source§

fn list_tags(&self) -> AppResult<Vec<Tag>>

Lists tags in the repository.
Source§

fn create_branch(&self, name: &str, target: &str) -> AppResult<()>

Creates a local branch pointing at the given target revision.
Source§

fn delete_branch(&self, name: &str) -> AppResult<()>

Deletes a local branch.
Source§

fn create_tag(&self, name: &str, target: &str, message: &str) -> AppResult<()>

Creates a tag pointing at the given target revision. An annotated tag (with tagger and message) is created when message is non-empty; a lightweight tag (a plain ref) is created when message is empty. Both backends must follow this convention.
Source§

fn delete_tag(&self, name: &str) -> AppResult<()>

Deletes a tag.
Source§

impl RemoteManager for Repo

Source§

fn list_remotes(&self) -> AppResult<Vec<Remote>>

Lists configured remotes.
Source§

fn fetch(&self, remote: &str, opts: Option<&FetchOptions>) -> AppResult<()>

Fetches updates from a remote.
Source§

fn push(&self, remote: &str, opts: Option<&PushOptions>) -> AppResult<()>

Pushes refs to a remote.
Source§

fn tracking_branch(&self, branch: &str) -> AppResult<String>

Returns the configured upstream tracking branch for a local branch.
Source§

impl Repository for Repo

Source§

fn root(&self) -> &Path

Returns the absolute path to the repository root.
Source§

fn head(&self) -> AppResult<Reference>

Returns the reference that HEAD points to.
Source§

fn resolve_ref(&self, refname: &str) -> AppResult<Oid>

Resolves a ref name (branch, tag, or SHA prefix) to an OID.
Source§

fn is_dirty(&self) -> AppResult<bool>

Reports whether the working tree has uncommitted changes.
Source§

impl Resetter for Repo

Source§

fn reset(&self, target: &str, mode: ResetMode) -> AppResult<()>

Resets repository state to the target revision.
Source§

impl Stasher for Repo

Source§

fn stash(&self, message: &str) -> AppResult<Oid>

Creates a stash entry.
Source§

fn stash_pop(&self) -> AppResult<()>

Applies and drops the top stash entry.
Source§

fn stash_pop_index(&self, index: usize) -> AppResult<()>

Applies and drops the selected stash entry.
Source§

fn stash_list(&self) -> AppResult<Vec<StashEntry>>

Lists stash entries.
Source§

fn stash_push(&self, message: &str) -> AppResult<Oid>

Creates a stash entry.
Source§

impl TreeReader for Repo

Source§

fn tree_hash(&self, revision: &str, path: &str) -> AppResult<TreeHash>

Returns the OID of the tree at the given path and revision.
Source§

fn file_at(&self, revision: &str, path: &str) -> AppResult<Vec<u8>>

Returns the content of a file at the given revision and path.
Source§

fn list_entries(&self, revision: &str, path: &str) -> AppResult<Vec<TreeEntry>>

Returns the entries in a tree at the given revision and path.

Auto Trait Implementations§

§

impl !Sync for Repo

§

impl Freeze for Repo

§

impl RefUnwindSafe for Repo

§

impl Send for Repo

§

impl Unpin for Repo

§

impl UnsafeUnpin for Repo

§

impl UnwindSafe for Repo

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more