Skip to main content

Repo

Struct Repo 

Source
pub struct Repo { /* private fields */ }
Expand description

Remote Git repository.

§Example

use thin_fetch::{HashKind, Repo};

let url = "https://git.ddd.rip/ptrcnull/thin-fetch.git";
let repo = Repo::new(url, HashKind::Sha1);

// perform an operation on the repo:
let refs = repo.list_refs();

Implementations§

Source§

impl Repo

Source

pub fn discover(&self) -> Result<Capabilities, Error>

§Errors
Source§

impl Repo

Source

pub fn fetch_blobs( &self, oid: &str, blobs: Vec<String>, ) -> Result<Vec<Object>, Error>

Fetch listed blobs for a given commit.

§Errors

Returns an error if the fetch command or parsing the response fails.

Source

pub fn fetch_tree( &self, have: &str, want: &str, blobs: bool, ) -> Result<Vec<Object>, Error>

Fetch commits between have and want, optionally including blobs.

§Errors

Returns an error if the fetch command or parsing the response fails.

Source

pub fn fetch_history_linear( &mut self, start: &str, end: &str, blobs: bool, ) -> Result<Vec<String>, Error>

Fetch commits between have and want, parsing them into a linear history.

§Errors

Returns an error if the fetch command fails, cannot parse the response, or the history is not linear.

Source

pub fn fetch_shallow(&mut self, oid: &str) -> Result<(), Error>

Fetch shallow tree for one commit, excluding blobs.

§Errors

Returns an error if the fetch command or parsing the response fails.

Source§

impl Repo

Source

pub fn get_hash_kind(&self) -> HashKind

Source

pub fn get_blob(&self, oid: &str) -> Option<&Blob>

Source

pub fn get_history_linear<'a>( &'a self, start: &str, end: &str, ) -> Result<Vec<Checkout<'a>>, Error>

Gets linear history of commits between start and end.

§Errors

Returns an error when the history is not linear.

Source§

impl Repo

Source

pub fn new_discover<S: Into<String>>(url: S) -> Result<Self, Error>

Create new repo with a given URL, discovering the hash kind from the server.

§Errors

Returns an error when the remote repo does not support v2 protocol, or does not send object-format in capabilities.

Source

pub fn new<S: Into<String>>(url: S, hash_kind: HashKind) -> Self

Create new repo with a given URL and hash kind.

Assumes that the remote repo does support v2 protocol.

Source

pub fn call<C: Into<Parcel>>(&self, cmd: C) -> Result<Parcel, Error>

Call the repo with a body that serializes into Parcel.

§Errors

Returns an error when the HTTP request fails, or the parcel cannot be parsed.

Source

pub fn stream<C: Into<Parcel>>( &self, cmd: C, ) -> Result<ParcelDecoder<BodyReader<'static>>, Error>

Call the repo with a body that serializes into Parcel.

§Errors

Returns an error when the HTTP request fails, or the parcel cannot be parsed.

Source

pub fn list_refs(&self) -> Result<Vec<Reference>, Error>

List all remote references.

§Errors

Returns an error when the command fails to execute.

Source

pub fn get_ref(&self, needle: &str) -> Result<Option<Reference>, Error>

Get value of single remote ref.

§Errors

Returns an error when the command fails to execute.

Source

pub fn list_refs_prefix<P: Into<String>>( &self, prefix: P, ) -> Result<Vec<Reference>, Error>

List all remote references, filtering by a given prefix.

§Errors

Returns an error when the command fails to execute.

Source

pub fn objects(&self) -> impl Iterator<Item = &Object>

Auto Trait Implementations§

§

impl Freeze for Repo

§

impl RefUnwindSafe for Repo

§

impl Send for Repo

§

impl Sync for Repo

§

impl Unpin for Repo

§

impl UnsafeUnpin for Repo

§

impl UnwindSafe for Repo

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.