Struct git2::Remote [] [src]

pub struct Remote<'repo> {
    // some fields omitted
}

A structure representing a remote of a git repository.

The lifetime is the lifetime of the repository that it is attached to. The remote is used to manage fetches and pushes as well as refspecs.

Methods

impl<'repo> Remote<'repo>
[src]

fn is_valid_name(remote_name: &str) -> bool

Ensure the remote name is well-formed.

fn name(&self) -> Option<&str>

Get the remote's name.

Returns None if this remote has not yet been named or if the name is not valid utf-8

fn name_bytes(&self) -> Option<&[u8]>

Get the remote's name, in bytes.

Returns None if this remote has not yet been named

fn url(&self) -> Option<&str>

Get the remote's url.

Returns None if the url is not valid utf-8

fn url_bytes(&self) -> &[u8]

Get the remote's url as a byte array.

fn pushurl(&self) -> Option<&str>

Get the remote's pushurl.

Returns None if the pushurl is not valid utf-8

fn pushurl_bytes(&self) -> Option<&[u8]>

Get the remote's pushurl as a byte array.

fn connect(&mut self, dir: Direction) -> Result<()Error>

Open a connection to a remote.

fn connected(&mut self) -> bool

Check whether the remote is connected

fn disconnect(&mut self)

Disconnect from the remote

fn download(&mut self, specs: &[&str], opts: Option<&mut FetchOptions>) -> Result<()Error>

Download and index the packfile

Connect to the remote if it hasn't been done yet, negotiate with the remote git which objects are missing, download and index the packfile.

The .idx file will be created and both it and the packfile with be renamed to their final name.

The specs argument is a list of refspecs to use for this negotiation and download. Use an empty array to use the base refspecs.

fn refspecs<'a>(&'a self) -> Refspecs<'a>

Get the number of refspecs for a remote

fn get_refspec(&self, i: usize) -> Option<Refspec<'repo>>

Get the nth refspec from this remote.

The refspecs iterator can be used to iterate over all refspecs.

fn fetch(&mut self, refspecs: &[&str], opts: Option<&mut FetchOptions>, reflog_msg: Option<&str>) -> Result<()Error>

Download new data and update tips

Convenience function to connect to a remote, download the data, disconnect and update the remote-tracking branches.

fn update_tips(&mut self, callbacks: Option<&mut RemoteCallbacks>, update_fetchhead: bool, download_tags: AutotagOption, msg: Option<&str>) -> Result<()Error>

Update the tips to the new state

fn push(&mut self, refspecs: &[&str], opts: Option<&mut PushOptions>) -> Result<()Error>

Perform a push

Perform all the steps for a push. If no refspecs are passed then the configured refspecs will be used.

fn stats(&self) -> Progress

Get the statistics structure that is filled in by the fetch operation.

fn list(&self) -> Result<&[RemoteHead]Error>

Get the remote repository's reference advertisement list.

Get the list of references with which the server responds to a new connection.

The remote (or more exactly its transport) must have connected to the remote repository. This list is available as soon as the connection to the remote is initiated and it remains available after disconnecting.

Trait Implementations

impl<'repo> Clone for Remote<'repo>
[src]

fn clone(&self) -> Remote<'repo>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<'repo> Drop for Remote<'repo>
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more