pub struct PrepareFetch { /* private fields */ }
Expand description

A utility to collect configuration on how to fetch from a remote and initiate a fetch operation. It will delete the newly created repository on when dropped without successfully finishing a fetch.

Implementations§

source§

impl PrepareFetch

Modification

source

pub fn fetch_only<P>( &mut self, progress: P, should_interrupt: &AtomicBool ) -> Result<(Repository, Outcome), Error>where P: Progress, P::SubProgress: 'static,

Available on crate feature blocking-network-client only.

Fetch a pack and update local branches according to refspecs, providing progress and checking should_interrupt to stop the operation. On success, the persisted repository is returned, and this method must not be called again to avoid a panic. On error, the method may be called again to retry as often as needed.

If the remote repository was empty, that is newly initialized, the returned repository will also be empty and like it was newly initialized.

Note that all data we created will be removed once this instance drops if the operation wasn’t successful.

source

pub fn fetch_then_checkout<P>( &mut self, progress: P, should_interrupt: &AtomicBool ) -> Result<(PrepareCheckout, Outcome), Error>where P: Progress, P::SubProgress: 'static,

Available on crate feature blocking-network-client only.

Similar to fetch_only(), but passes ownership to a utility type to configure a checkout operation.

source§

impl PrepareFetch

Builder

source

pub fn with_fetch_options(self, opts: Options) -> Self

Available on crate features async-network-client or blocking-network-client only.

Set additional options to adjust parts of the fetch operation that are not affected by the git configuration.

source

pub fn configure_remote( self, f: impl FnMut(Remote<'_>) -> Result<Remote<'_>, Box<dyn Error + Send + Sync>> + 'static ) -> Self

Use f to apply arbitrary changes to the remote that is about to be used to fetch a pack.

The passed in remote will be un-named and pre-configured to be a default remote as we know it from git-clone. It is not yet present in the configuration of the repository, but each change it will eventually be written to the configuration prior to performing a the fetch operation, all changes done in f() will be persisted.

It can also be used to configure additional options, like those for fetching tags. Note that with_fetch_tags() should be called here to configure the clone as desired. Otherwise a clone is configured to be complete and fetches all tags, not only those reachable from all branches.

source

pub fn with_remote_name(self, name: impl Into<BString>) -> Result<Self, Error>

Set the remote’s name to the given value after it was configured using the function provided via configure_remote().

If not set here, it defaults to origin or the value of clone.defaultRemoteName.

source§

impl PrepareFetch

Consumption

source

pub fn persist(self) -> Repository

Persist the contained repository as is even if an error may have occurred when fetching from the remote.

source§

impl PrepareFetch

Instantiation

source

pub fn new<Url, E>( url: Url, path: impl AsRef<Path>, kind: Kind, create_opts: Options, open_opts: Options ) -> Result<Self, Error>where Url: TryInto<Url, Error = E>, Error: From<E>,

Create a new repository at path with crate_opts which is ready to clone from url, possibly after making additional adjustments to configuration and settings.

Note that this is merely a handle to perform the actual connection to the remote, and if any of it fails the freshly initialized repository will be removed automatically as soon as this instance drops.

Trait Implementations§

source§

impl Drop for PrepareFetch

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<PrepareFetch> for Repository

source§

fn from(prep: PrepareFetch) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.