pub struct GitVcs;Expand description
Git implementation of the VCS trait.
Implementations§
Source§impl GitVcs
impl GitVcs
Sourcepub fn version(&self) -> Result<GitVersion, JoyError>
pub fn version(&self) -> Result<GitVersion, JoyError>
Get the installed git version. Returns error if git is not found.
Sourcepub fn check_version(&self) -> Result<GitVersion, JoyError>
pub fn check_version(&self) -> Result<GitVersion, JoyError>
Check that git meets the minimum version requirement.
Source§impl GitVcs
impl GitVcs
Sourcepub fn commit(&self, root: &Path, message: &str) -> Result<(), JoyError>
pub fn commit(&self, root: &Path, message: &str) -> Result<(), JoyError>
Create a commit with a message.
Sourcepub fn tag_annotated(
&self,
root: &Path,
name: &str,
body: &str,
) -> Result<(), JoyError>
pub fn tag_annotated( &self, root: &Path, name: &str, body: &str, ) -> Result<(), JoyError>
Create an annotated tag with a message body.
Sourcepub fn push(&self, root: &Path, remote: &str) -> Result<(), JoyError>
pub fn push(&self, root: &Path, remote: &str) -> Result<(), JoyError>
Push the current branch to a remote.
Sourcepub fn push_tag(
&self,
root: &Path,
remote: &str,
tag: &str,
) -> Result<(), JoyError>
pub fn push_tag( &self, root: &Path, remote: &str, tag: &str, ) -> Result<(), JoyError>
Push a specific tag to a remote.
Push current branch and tags in one call.
Sourcepub fn default_remote(&self, root: &Path) -> Result<String, JoyError>
pub fn default_remote(&self, root: &Path) -> Result<String, JoyError>
Get the default remote name (usually “origin”).
Sourcepub fn remote_url(&self, root: &Path, remote: &str) -> Result<String, JoyError>
pub fn remote_url(&self, root: &Path, remote: &str) -> Result<String, JoyError>
Get the remote URL for a given remote name.
Sourcepub fn is_clean(&self, root: &Path) -> Result<bool, JoyError>
pub fn is_clean(&self, root: &Path) -> Result<bool, JoyError>
Check if the working tree is clean.
Sourcepub fn head_is_tagged(&self, root: &Path) -> bool
pub fn head_is_tagged(&self, root: &Path) -> bool
Check if HEAD is exactly on a tag.
Trait Implementations§
Source§impl Vcs for GitVcs
impl Vcs for GitVcs
Source§fn is_repo(&self, root: &Path) -> bool
fn is_repo(&self, root: &Path) -> bool
Check if the given directory is inside a VCS repository.
Source§fn init_repo(&self, root: &Path) -> Result<(), JoyError>
fn init_repo(&self, root: &Path) -> Result<(), JoyError>
Initialize a new repository at the given path.
Source§fn user_email(&self) -> Result<String, JoyError>
fn user_email(&self) -> Result<String, JoyError>
Get the current user’s email from VCS config.
List all version tags (e.g. v0.5.0), sorted descending.
Source§fn latest_version_tag(&self, root: &Path) -> Result<Option<String>, JoyError>
fn latest_version_tag(&self, root: &Path) -> Result<Option<String>, JoyError>
Get the latest reachable version tag, if any.
Source§fn config_get(&self, root: &Path, key: &str) -> Result<String, JoyError>
fn config_get(&self, root: &Path, key: &str) -> Result<String, JoyError>
Read a per-clone VCS-config value. The semantics are
Git-flavoured (
git config --local <key>); other backends
implement on the closest equivalent (jj has jj config, pijul
pijul config).Source§fn config_set(
&self,
root: &Path,
key: &str,
value: &str,
) -> Result<(), JoyError>
fn config_set( &self, root: &Path, key: &str, value: &str, ) -> Result<(), JoyError>
Write a per-clone VCS-config value. Same semantics as
Vcs::config_get.Auto Trait Implementations§
impl Freeze for GitVcs
impl RefUnwindSafe for GitVcs
impl Send for GitVcs
impl Sync for GitVcs
impl Unpin for GitVcs
impl UnsafeUnpin for GitVcs
impl UnwindSafe for GitVcs
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