pub enum RemoteTarget {
Configured,
Upstream,
AllRemotes,
AllTags,
Prompted,
}Expand description
MG.16: one detached git operation, named once.
The transient item (C-c g p) and the ex-command (:magit-pull)
both resolve to one of these constants and call
spawn_remote_op — the operation is defined in exactly one
place, so the two surfaces cannot drift in argv, in echo text, or
in how the outcome is reported.
MG.17a: flags extends that to the optional arguments. The order
of the slice IS the args_schema order, which is what lets a
transient toggle and a --force on the : line resolve to the
same Args::List slot.
MG.41c: where a remote operation sends or takes its refs.
Magit’s push / pull / fetch menus are one operation with several destinations, not several operations — which is why a single unlabelled “push” row was the wrong shape. Modelling the destination as data means push gains six rows and one handler rather than six handlers.
Variants§
Configured
Whatever git itself resolves with no destination argument:
branch.<name>.pushRemote, then remote.pushDefault, then
branch.<name>.remote. Magit’s p.
Upstream
The branch’s @{upstream}, resolved explicitly. Magit’s u.
Distinct from Self::Configured whenever pushRemote and
the upstream differ — the triangular-workflow case the two rows
exist to separate. Git has no single-token spelling for it, so
this is resolved with a rev-parse at run time.
AllRemotes
Every configured remote (--all). Magit’s a, fetch only.
AllTags
Every tag (--tags). Magit’s t, push only.
Prompted
A destination the user types — a remote, a branch, a refspec, a
tag. Magit’s e / o / r / T, which differ only in what
they prompt for.
Implementations§
Source§impl RemoteTarget
impl RemoteTarget
Sourcepub fn argv(self, resolved: Option<&str>) -> Vec<String>
pub fn argv(self, resolved: Option<&str>) -> Vec<String>
Extra argv this target contributes, appended after the flags.
resolved carries the value a Self::Prompted target asked
for, or the remote branch pair a Self::Upstream lookup
produced. Returning a Vec rather than an Option<String> is
what lets Upstream expand to two tokens.
Trait Implementations§
Source§impl Clone for RemoteTarget
impl Clone for RemoteTarget
Source§fn clone(&self) -> RemoteTarget
fn clone(&self) -> RemoteTarget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RemoteTarget
Source§impl Debug for RemoteTarget
impl Debug for RemoteTarget
impl Eq for RemoteTarget
Source§impl PartialEq for RemoteTarget
impl PartialEq for RemoteTarget
impl StructuralPartialEq for RemoteTarget
Auto Trait Implementations§
impl Freeze for RemoteTarget
impl RefUnwindSafe for RemoteTarget
impl Send for RemoteTarget
impl Sync for RemoteTarget
impl Unpin for RemoteTarget
impl UnsafeUnpin for RemoteTarget
impl UnwindSafe for RemoteTarget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more