pub struct GitRepo { /* private fields */ }Implementations§
Source§impl GitRepo
impl GitRepo
Sourcepub fn open() -> WtgResult<Self>
pub fn open() -> WtgResult<Self>
Open the git repository from the current directory. Fetch is disabled by default for local repos.
Sourcepub fn from_path(path: &Path) -> WtgResult<Self>
pub fn from_path(path: &Path) -> WtgResult<Self>
Open the git repository from a specific path. Fetch is disabled by default.
Sourcepub fn remote(gh_repo_info: GhRepoInfo) -> WtgResult<Self>
pub fn remote(gh_repo_info: GhRepoInfo) -> WtgResult<Self>
Open or clone a remote GitHub repository. Uses a cache directory (~/.cache/wtg/repos). Fetch is enabled by default.
Sourcepub fn remote_with_notices(
gh_repo_info: GhRepoInfo,
notice_cb: NoticeCallback,
) -> WtgResult<Self>
pub fn remote_with_notices( gh_repo_info: GhRepoInfo, notice_cb: NoticeCallback, ) -> WtgResult<Self>
Open or clone a remote GitHub repository with a notice callback. Uses a cache directory (~/.cache/wtg/repos). Fetch is enabled by default.
Sourcepub fn remote_url(&self) -> Option<&str>
pub fn remote_url(&self) -> Option<&str>
Get the remote URL for fetching
Sourcepub const fn set_allow_fetch(&mut self, allow: bool)
pub const fn set_allow_fetch(&mut self, allow: bool)
Set whether fetching is allowed.
Use this to enable --fetch flag for local repos.
Sourcepub fn set_notice_callback(&mut self, cb: NoticeCallback)
pub fn set_notice_callback(&mut self, cb: NoticeCallback)
Set the notice callback for emitting operational messages.
Sourcepub const fn gh_repo_info(&self) -> Option<&GhRepoInfo>
pub const fn gh_repo_info(&self) -> Option<&GhRepoInfo>
Get a reference to the stored GitHub repo info (owner/repo) if explicitly set.
Sourcepub fn find_commit(&self, hash_str: &str) -> WtgResult<Option<CommitInfo>>
pub fn find_commit(&self, hash_str: &str) -> WtgResult<Option<CommitInfo>>
Find a commit by hash (can be short or full).
If allow_fetch is true and the commit isn’t found locally, attempts to fetch it.
Sourcepub fn find_commit_local(&self, hash_str: &str) -> Option<CommitInfo>
pub fn find_commit_local(&self, hash_str: &str) -> Option<CommitInfo>
Find a commit by hash locally only (no fetch).
pub fn has_path_at_head(&self, path: &str) -> bool
pub fn has_tag_named(&self, name: &str) -> bool
pub fn find_branch_path_match( &self, segments: &[String], ) -> Option<(String, Vec<String>)>
Sourcepub fn find_file_on_branch(&self, branch: &str, path: &str) -> Option<FileInfo>
pub fn find_file_on_branch(&self, branch: &str, path: &str) -> Option<FileInfo>
Find a file in the repository
Get all tags in the repository.
Sourcepub fn commits_between(
&self,
from_ref: &str,
to_ref: &str,
limit: usize,
) -> Vec<CommitInfo>
pub fn commits_between( &self, from_ref: &str, to_ref: &str, limit: usize, ) -> Vec<CommitInfo>
Get commits between two refs (from exclusive, to inclusive). Returns commits in reverse chronological order (most recent first).
Expose tags that contain the specified commit.
If allow_fetch is true, ensures tags are fetched first.
Sourcepub fn tag_from_release(&self, release: &ReleaseInfo) -> Option<TagInfo>
pub fn tag_from_release(&self, release: &ReleaseInfo) -> Option<TagInfo>
Convert a GitHub release into tag metadata if the tag exists locally.
Sourcepub fn tag_contains_commit(
&self,
tag_commit_hash: &str,
commit_hash: &str,
) -> bool
pub fn tag_contains_commit( &self, tag_commit_hash: &str, commit_hash: &str, ) -> bool
Check whether a release tag contains the specified commit.
Sourcepub fn remotes(&self) -> impl Iterator<Item = RemoteInfo>
pub fn remotes(&self) -> impl Iterator<Item = RemoteInfo>
Iterate over all remotes in the repository.
Returns an iterator of RemoteInfo.
Sourcepub fn github_remote(&self) -> Option<GhRepoInfo>
pub fn github_remote(&self) -> Option<GhRepoInfo>
Get the GitHub remote info.
Returns stored gh_repo_info if set, otherwise extracts from git remotes
using the remotes() API with priority ordering (upstream > origin > other,
GitHub remotes first within each kind).
Auto Trait Implementations§
impl !Freeze for GitRepo
impl !RefUnwindSafe for GitRepo
impl Send for GitRepo
impl Sync for GitRepo
impl Unpin for GitRepo
impl UnsafeUnpin for GitRepo
impl !UnwindSafe for GitRepo
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