pub struct Repository { /* private fields */ }
Expand description
A local git repository
Implementations§
Source§impl Repository
impl Repository
Sourcepub fn new<P: AsRef<Path>>(p: P) -> Repository
pub fn new<P: AsRef<Path>>(p: P) -> Repository
Create a Repository struct from a pre-existing local git repository
Sourcepub fn clone<P: AsRef<Path>>(url: GitUrl, p: P) -> Result<Repository>
pub fn clone<P: AsRef<Path>>(url: GitUrl, p: P) -> Result<Repository>
Clone a remote git repository locally
Sourcepub fn init<P: AsRef<Path>>(p: P) -> Result<Repository>
pub fn init<P: AsRef<Path>>(p: P) -> Result<Repository>
Initialise a given folder as a git repository
Sourcepub fn create_local_branch(&self, branch_name: &BranchName) -> Result<()>
pub fn create_local_branch(&self, branch_name: &BranchName) -> Result<()>
Create and checkout a new local branch
Sourcepub fn switch_branch(&self, branch_name: &BranchName) -> Result<()>
pub fn switch_branch(&self, branch_name: &BranchName) -> Result<()>
Checkout the specified branch
Sourcepub fn remove(&self, pathspecs: Vec<&str>, force: bool) -> Result<()>
pub fn remove(&self, pathspecs: Vec<&str>, force: bool) -> Result<()>
Remove file contents from the index
Sourcepub fn commit_all(&self, message: &str) -> Result<()>
pub fn commit_all(&self, message: &str) -> Result<()>
Commit all staged files
Sourcepub fn push_to_upstream(
&self,
upstream: &str,
upstream_branch: &BranchName,
) -> Result<()>
pub fn push_to_upstream( &self, upstream: &str, upstream_branch: &BranchName, ) -> Result<()>
Push the curent branch to its associated remote, specifying the upstream branch
Sourcepub fn fetch_remote(&self, remote: &str) -> Result<()>
pub fn fetch_remote(&self, remote: &str) -> Result<()>
Fetch a remote
Sourcepub fn create_branch_from_startpoint(
&self,
branch_name: &BranchName,
startpoint: &str,
) -> Result<()>
pub fn create_branch_from_startpoint( &self, branch_name: &BranchName, startpoint: &str, ) -> Result<()>
Create a new branch from a start point, such as another local or remote branch
Sourcepub fn list_branches(&self) -> Result<Vec<String>>
pub fn list_branches(&self) -> Result<Vec<String>>
List local branches
Sourcepub fn list_added(&self) -> Result<Vec<String>>
pub fn list_added(&self) -> Result<Vec<String>>
List files added to staging area
Sourcepub fn list_modified(&self) -> Result<Vec<String>>
pub fn list_modified(&self) -> Result<Vec<String>>
List all modified files
Sourcepub fn list_untracked(&self) -> Result<Vec<String>>
pub fn list_untracked(&self) -> Result<Vec<String>>
List all untracked files
Sourcepub fn list_tracked(&self) -> Result<Vec<String>>
pub fn list_tracked(&self) -> Result<Vec<String>>
List tracked files
Sourcepub fn show_remote_uri(&self, remote_name: &str) -> Result<String>
pub fn show_remote_uri(&self, remote_name: &str) -> Result<String>
List all the remote URI for name
Sourcepub fn list_remotes(&self) -> Result<Vec<String>>
pub fn list_remotes(&self) -> Result<Vec<String>>
List all the remote URI for name
Auto Trait Implementations§
impl Freeze for Repository
impl RefUnwindSafe for Repository
impl Send for Repository
impl Sync for Repository
impl Unpin for Repository
impl UnwindSafe for Repository
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