[][src]Struct skellige::prelude::git::Repo

pub struct Repo<'a> { /* fields omitted */ }

Git repository

Implementations

impl<'a> Repo<'a>[src]

pub fn branch_val(&self) -> Option<&str>[src]

Returns the target branch for this repo. Defaults to master internally when not set.

Examples

use skellige::prelude::*;

assert_eq!(git::Repo::new("foo").unwrap().branch("foobar").branch_val(), Some("foobar"));

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

Returns the branch flag's value for this repo.

Examples

use skellige::prelude::*;

assert_eq!(git::Repo::new("foo").unwrap().branch_only(true).branch_only_val(), true);

pub fn path_val(&self) -> &Path[src]

Returns the local location on disk for this repo

Examples

use skellige::prelude::*;

assert_eq!(git::Repo::new("foo").unwrap().path_val(), Path::new("foo").abs().unwrap().as_path());

pub fn url_val(&self) -> Option<&str>[src]

Returns the remote location for this repo

Examples

use skellige::prelude::*;

assert_eq!(git::Repo::new("foo").unwrap().url("foobar").url_val(), Some("foobar"));

pub fn branch<T>(self, branch: T) -> Self where
    T: AsRef<str>, 
[src]

Set the branch to target for this repo

Examples

use skellige::prelude::*;

assert_eq!(git::Repo::new("foo").unwrap().branch("foobar").branch_val(), Some("foobar"));

pub fn branch_only(self, yes: bool) -> Self[src]

Set to target the branch only and not the entire repo.

Examples

use skellige::prelude::*;

assert_eq!(git::Repo::new("foo").unwrap().branch_only(true).branch_only_val(), true);

pub fn url<T>(self, url: T) -> Self where
    T: AsRef<str>, 
[src]

Set the remote location for this repo

Examples

use skellige::prelude::*;

git::Repo::new("foo").unwrap().url("foobar");

pub fn xfer_progress<T>(self, func: T) -> Self where
    T: FnMut(u64, u64) + 'a, 
[src]

Set the transfer progress callback to use.

Examples

use skellige::prelude::*;

git::Repo::new("foo").unwrap().url("foobar");

pub fn checkout_progress<T>(self, func: T) -> Self where
    T: FnMut(u64, u64) + 'a, 
[src]

Set the checkout progress callback to use.

Examples

use skellige::prelude::*;

git::Repo::new("foo").unwrap().url("foobar");

pub fn update_progress<T>(self, func: T) -> Self where
    T: FnMut(u64, u64) + 'a, 
[src]

Set the update progress callback to use.

Examples

use skellige::prelude::*;

git::Repo::new("foo").unwrap().url("foobar");

pub fn new<T>(path: T) -> Result<Self> where
    T: AsRef<Path>, 
[src]

Create a new repo instance based on the given path

Examples

use skellige::prelude::*;

assert!(git::Repo::new("foo").is_ok());

pub fn last_msg(&self) -> Result<String>[src]

Returns the message from the head commit.

Examples

use skellige::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("git_repo_last_msg_doc");
assert!(sys::remove_all(&tmpdir).is_ok());
let tarball = tmpdir.mash("../../alpine-base.tgz");
assert!(tar::extract_all(&tarball, &tmpdir).is_ok());
assert_eq!(git::Repo::new(&tmpdir).unwrap().last_msg().unwrap(), "Use the workflow name for the badge".to_string());
assert!(sys::remove_all(&tmpdir).is_ok());

pub fn clone(self) -> Result<PathBuf>[src]

Clone the repo locally. Clones the entire repo unless branch_only is set to true. Calling this function consumes any progress callbacks you may have set.

Examples

use skellige::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("git_repo_clone_doc");
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(sys::mkdir(&tmpdir).is_ok());
let tmpfile = tmpdir.mash("README.md");
assert_eq!(tmpfile.exists(), false);
assert!(git::Repo::new(&tmpdir).unwrap().url("https://github.com/phR0ze/alpine-base").clone().is_ok());
assert_eq!(tmpfile.exists(), true);
assert!(sys::remove_all(&tmpdir).is_ok());

pub fn update(self) -> Result<PathBuf>[src]

Update the given repo, cloning the repo if it doesn't exist.

Examples

use skellige::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("git_repo_update_doc");
assert!(sys::remove_all(&tmpdir).is_ok());
assert!(sys::mkdir(&tmpdir).is_ok());
let tmpfile = tmpdir.mash("README.md");
assert_eq!(tmpfile.exists(), false);
assert!(git::Repo::new(&tmpdir).unwrap().url("https://github.com/phR0ze/alpine-base").update().is_ok());
assert_eq!(tmpfile.exists(), true);
assert!(sys::remove_all(&tmpdir).is_ok());

Trait Implementations

impl<'a> Default for Repo<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Repo<'a>[src]

impl<'a> !Send for Repo<'a>[src]

impl<'a> !Sync for Repo<'a>[src]

impl<'a> Unpin for Repo<'a>[src]

impl<'a> !UnwindSafe for Repo<'a>[src]

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> Same<T> for T

type Output = T

Should always be Self

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.