[][src]Struct mhgit::Repository

pub struct Repository { /* fields omitted */ }

A handle to a git repository.

By creating with at the repository may be somewhere other than in current working directory.

use mhgit::Repository;
Repository::at("/home/mh/awesomeness")?
           .init()?
           .add()?
           .commit("Initial commit")?;

Implementations

impl Repository[src]

pub fn new() -> Repository[src]

Get a repository in the current directory.

use mhgit::Repository;
let status = Repository::new()
                        .status()?;

pub fn at<P: AsRef<Path>>(path: P) -> Result<Repository, Error>[src]

Get a repository at the given location.

use mhgit::Repository;
Repository::at("/home/mh/awesomeness")?
           .init()?;

pub fn is_init(&self) -> bool[src]

Return true if the repository is initialized.

pub fn gitout(&mut self, val: GitOut) -> &mut Repository[src]

Configure if the output of git commands run in this repo should be piped or printed to screen.

Piping is default.

use mhgit::Repository;
use mhgit::GitOut::Print;
Repository::new()
    .gitout(Print)
    .status()?;

pub fn add(&mut self) -> Result<&mut Self, Error>[src]

Run git add in the repository.

The command is called with the --all option. To call git add with different options use AddOptions.

pub fn commit(&mut self, msg: &str) -> Result<&mut Self, Error>[src]

Run git commit in the repository, with the given commit message.

The command is called with --allow-empty, avoiding errors if no changes were added since last commit. To call git commit with different options use CommitOptions.

pub fn fetch(&mut self) -> Result<&mut Self, Error>[src]

Run git fetch in the repository.

The command is called with --all

pub fn init(&mut self) -> Result<&mut Self, Error>[src]

Run git init, initializing the repository.

pub fn notes(&mut self, msg: &str) -> Result<&mut Self, Error>[src]

Run git notes add, adding a note to HEAD.

To call git notes with different optinos use NotesOptions.

pub fn pull(&mut self) -> Result<&mut Self, Error>[src]

Run git pull without specifying remote or refs.

To call git pull with different options use PullOptions.

pub fn push(&mut self) -> Result<&mut Self, Error>[src]

Run git push without specifying remote or refs.

To call git push with different options use PushOptions.

pub fn remote(&mut self, name: &str, url: &str) -> Result<&mut Self, Error>[src]

Run git remote add in the repository.

This adds a single remote to the repository. To call git remote with different options use RemoteOptions.

pub fn status(&self) -> Result<Status, Error>[src]

Run git status parsing the status into idiomatic Rust type.

The status information is returned in a Status.

pub fn stash(&mut self) -> Result<&mut Self, Error>[src]

Run git stash in the repository.

The command is run without ony options.

pub fn tag(&mut self, tagname: &str) -> Result<&mut Self, Error>[src]

Run git tag, creating a new tag object.

To call git tag with different options use TagOptions.

Trait Implementations

impl Debug for Repository[src]

impl Default for Repository[src]

impl Eq for Repository[src]

impl Hash for Repository[src]

impl PartialEq<Repository> for Repository[src]

impl StructuralEq for Repository[src]

impl StructuralPartialEq for Repository[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.