Skip to main content

Remote

Struct Remote 

Source
pub struct Remote;
Expand description

Remote management — list, add, rename, remove, set-url, prune.

The peer of crate::Branch and crate::Stash: a thin, typed wrapper over the git CLI. Fetch / pull / push are not here — those are long-running network operations owned by lattice-magit’s RemoteOp, which runs them detached. Everything on this type is a local config edit that returns immediately.

Implementations§

Source§

impl Remote

Source

pub fn list(repo: &Repository) -> Result<Vec<RemoteEntry>>

List every configured remote with its fetch and push URLs.

Equivalent to git remote -v.

Source

pub fn add(repo: &Repository, name: &str, url: &str) -> Result<()>

Add a new remote.

Equivalent to git remote add <name> <url>. Does not fetch.

Source

pub fn rename(repo: &Repository, old: &str, new: &str) -> Result<()>

Rename a remote, rewriting its tracking refspecs.

Equivalent to git remote rename <old> <new>.

Source

pub fn remove(repo: &Repository, name: &str) -> Result<()>

Remove a remote and its remote-tracking branches.

Equivalent to git remote remove <name>.

Source

pub fn set_url(repo: &Repository, name: &str, url: &str) -> Result<()>

Point a remote at a different URL.

Equivalent to git remote set-url <name> <url>. This sets the fetch URL; a remote with a separately-configured pushurl keeps it, which is why RemoteEntry carries both.

Source

pub fn prune(repo: &Repository, name: &str) -> Result<()>

Delete local refs for branches that no longer exist on the remote.

Equivalent to git remote prune <name>. This talks to the network, so callers run it off the actor thread like the other remote operations.

Auto Trait Implementations§

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 = Infallible

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

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

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.