pub struct GitVcs {
pub root: PathBuf,
/* private fields */
}Fields§
§root: PathBufRoot path — used for resolving relative paths.
Implementations§
Trait Implementations§
Source§impl Vcs for GitVcs
impl Vcs for GitVcs
Source§fn status(&self) -> Result<(Vec<StatusEntry>, Vec<StatusEntry>)>
fn status(&self) -> Result<(Vec<StatusEntry>, Vec<StatusEntry>)>
Returns
(staged, unstaged) file lists.Source§fn diff_file(&self, path: &Path, staged: bool) -> Result<Vec<DiffLine>>
fn diff_file(&self, path: &Path, staged: bool) -> Result<Vec<DiffLine>>
Diff for a single file.
staged = true → HEAD ↔ index (what would be committed).
staged = false → index ↔ workdir (what is not yet staged).fn stage_file(&self, path: &Path) -> Result<()>
fn unstage_file(&self, path: &Path) -> Result<()>
Source§fn stage_lines(
&self,
path: &Path,
selected: &[usize],
diff: &[DiffLine],
) -> Result<()>
fn stage_lines( &self, path: &Path, selected: &[usize], diff: &[DiffLine], ) -> Result<()>
Stage only the selected lines (by index into
diff).
Uses direct git2 index blob manipulation — no subprocess required.Source§fn unstage_lines(
&self,
path: &Path,
selected: &[usize],
diff: &[DiffLine],
) -> Result<()>
fn unstage_lines( &self, path: &Path, selected: &[usize], diff: &[DiffLine], ) -> Result<()>
Unstage only the selected lines (revert them to HEAD content in the index).
fn commit(&self, message: &str) -> Result<()>
fn create_branch(&self, name: &str) -> Result<()>
fn checkout_branch(&self, name: &str) -> Result<()>
Source§fn log_commits(&self, max: usize, filter: &str) -> Result<Vec<CommitInfo>>
fn log_commits(&self, max: usize, filter: &str) -> Result<Vec<CommitInfo>>
Return up to
max commits reachable from HEAD, optionally filtered by
a case-insensitive substring that matches summary, author name, or OID.Source§fn commit_files(&self, oid: &str) -> Result<Vec<FileChange>>
fn commit_files(&self, oid: &str) -> Result<Vec<FileChange>>
Return the list of files changed in the commit identified by the full
40-char hex
oid.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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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