pub struct Remote<'repo> { /* private fields */ }
Expand description

A remote which represents a way to interact with hosts for remote clones of the parent repository.

Implementations

Builder methods

Set the url to be used when pushing data to a remote.

Set the url to be used when pushing data to a remote, without applying rewrite rules in case these could be faulty, eliminating one failure mode.

Add spec as refspec for direction to our list if it’s unique.

Establishing connections to remote hosts

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

Create a new connection using transport to communicate, with progress to indicate changes.

Note that this method expects the transport to be created by the user, which would involve the url(). It’s meant to be used when async operation is needed with runtimes of the user’s choice.

Available on (crate features async-network-client or blocking-network-client) and (crate features blocking-network-client or async-network-client-async-std) only.

Connect to the url suitable for direction and return a handle through which operations can be performed.

Note that the protocol.version configuration key affects the transport protocol used to connect, with 2 being the default.

Access

Return the name of this remote or None if it wasn’t persisted to disk yet.

Return the set of ref-specs used for direction, which may be empty, in order of occurrence in the configuration.

Return the url used for the given direction with rewrites from url.<base>.insteadOf|pushInsteadOf, unless the instance was created with one of the _without_url_rewrite() methods. For pushing, this is the remote.<name>.pushUrl or the remote.<name>.url used for fetching, and for fetching it’s the remote.<name>.url. Note that it’s possible to only have the push url set, in which case there will be no way to fetch from the remote as the push-url isn’t used for that.

Modification

Read url.<base>.insteadOf|pushInsteadOf configuration variables and apply them to our urls, changing them in place.

This happens only once, and one if them may be changed even when reporting an error. If both urls fail, only the first error (for fetch urls) is reported.

Replace all currently set refspecs, typically from configuration, with the given specs for direction, or None if one of the input specs could not be parsed.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.