[−][src]Struct git_workarea::GitContext
A context for performing git commands.
Implementations
impl GitContext
[src]
pub fn new<P>(gitdir: P) -> Self where
P: Into<PathBuf>,
[src]
P: Into<PathBuf>,
Create a new context for the given directory.
pub fn new_with_config<P, C>(gitdir: P, config: C) -> Self where
P: Into<PathBuf>,
C: Into<PathBuf>,
[src]
P: Into<PathBuf>,
C: Into<PathBuf>,
Create a new context for the given directory with git configuration.
pub fn git(&self) -> Command
[src]
Run a git command in the context.
This builds a Command
with the proper environment to operate within the context.
pub fn fetch<R, I, N>(&self, remote: R, refnames: I) -> Result<(), GitError> where
R: AsRef<str>,
I: IntoIterator<Item = N>,
N: AsRef<OsStr>,
[src]
R: AsRef<str>,
I: IntoIterator<Item = N>,
N: AsRef<OsStr>,
Fetch references from the given remote.
The remote is interpreted by Git, so it can be a remote or a specific URL.
pub fn fetch_into<R, N, T>(
&self,
remote: R,
refname: N,
target: T
) -> Result<(), GitError> where
R: AsRef<str>,
N: AsRef<str>,
T: AsRef<str>,
[src]
&self,
remote: R,
refname: N,
target: T
) -> Result<(), GitError> where
R: AsRef<str>,
N: AsRef<str>,
T: AsRef<str>,
Fetch a commit from the given remote into a specific local refname.
pub fn force_fetch_into<R, N, T>(
&self,
remote: R,
refname: N,
target: T
) -> Result<(), GitError> where
R: AsRef<str>,
N: AsRef<str>,
T: AsRef<str>,
[src]
&self,
remote: R,
refname: N,
target: T
) -> Result<(), GitError> where
R: AsRef<str>,
N: AsRef<str>,
T: AsRef<str>,
Fetch a commit from the given remote into a specific local refname, allowing rewinds.
pub fn default_branch(&self) -> Result<Option<String>, GitError>
[src]
Determine the "default branch" for the repository.
pub fn prepare(&self, rev: &CommitId) -> Result<GitWorkArea, WorkAreaError>
[src]
Create a tree where further work on the given revision can occur.
pub fn reserve_ref<N>(
&self,
name: N,
commit: &CommitId
) -> Result<(String, usize), GitError> where
N: AsRef<str>,
[src]
&self,
name: N,
commit: &CommitId
) -> Result<(String, usize), GitError> where
N: AsRef<str>,
Reserve a refname for the given commit.
Returns the name of the reserved ref pointing to the given commit and its ID.
The reserved reference is created as refs/{name}/heads/{id}
where id
is a unique
integer (which is also returned).
pub fn reserve_refs<N>(
&self,
name: N,
commit: &CommitId
) -> Result<(String, String), GitError> where
N: AsRef<str>,
[src]
&self,
name: N,
commit: &CommitId
) -> Result<(String, String), GitError> where
N: AsRef<str>,
Reserve two refnames for the given commit.
Returns the names of the two reserved refs, the first pointing to the given commit and the second available for further work.
The reserved references are created as refs/{name}/heads/{id}
and
refs/{name}/bases/{id}
where the bases
reference is available to point to an object
associated with the heads
reference.
It is assumed that the bases
refs are aligned with the heads
references and not used
for other purposes.
pub fn mergeable(
&self,
base: &CommitId,
topic: &CommitId
) -> Result<MergeStatus, GitError>
[src]
&self,
base: &CommitId,
topic: &CommitId
) -> Result<MergeStatus, GitError>
Check if a topic commit is mergeable into a target branch.
pub fn gitdir(&self) -> &Path
[src]
The path to the git repository.
Trait Implementations
impl Clone for GitContext
[src]
fn clone(&self) -> GitContext
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for GitContext
[src]
Auto Trait Implementations
impl RefUnwindSafe for GitContext
impl Send for GitContext
impl Sync for GitContext
impl Unpin for GitContext
impl UnwindSafe for GitContext
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,