pub struct View { /* private fields */ }
Expand description
A wrapper around op_store::View
that defines additional methods.
Implementations§
source§impl View
impl View
pub fn new(op_store_view: View) -> Self
pub fn wc_commit_ids(&self) -> &HashMap<WorkspaceId, CommitId>
pub fn get_wc_commit_id(&self, workspace_id: &WorkspaceId) -> Option<&CommitId>
pub fn workspaces_for_wc_commit_id( &self, commit_id: &CommitId, ) -> Vec<WorkspaceId>
pub fn is_wc_commit_id(&self, commit_id: &CommitId) -> bool
pub fn heads(&self) -> &HashSet<CommitId>
sourcepub fn branches(&self) -> impl Iterator<Item = (&str, BranchTarget<'_>)>
pub fn branches(&self) -> impl Iterator<Item = (&str, BranchTarget<'_>)>
Iterates pair of local and remote branches by branch name.
pub fn git_refs(&self) -> &BTreeMap<String, RefTarget>
pub fn git_head(&self) -> &RefTarget
pub fn set_wc_commit(&mut self, workspace_id: WorkspaceId, commit_id: CommitId)
pub fn remove_wc_commit(&mut self, workspace_id: &WorkspaceId)
pub fn add_head(&mut self, head_id: &CommitId)
pub fn remove_head(&mut self, head_id: &CommitId)
sourcepub fn local_branches(&self) -> impl Iterator<Item = (&str, &RefTarget)>
pub fn local_branches(&self) -> impl Iterator<Item = (&str, &RefTarget)>
Iterates local branch (name, target)
s in lexicographical order.
sourcepub fn local_branches_for_commit<'a: 'b, 'b>(
&'a self,
commit_id: &'b CommitId,
) -> impl Iterator<Item = (&'a str, &'a RefTarget)> + 'b
pub fn local_branches_for_commit<'a: 'b, 'b>( &'a self, commit_id: &'b CommitId, ) -> impl Iterator<Item = (&'a str, &'a RefTarget)> + 'b
Iterates local branches (name, target)
in lexicographical order where
the target adds commit_id
.
sourcepub fn local_branches_matching<'a: 'b, 'b>(
&'a self,
pattern: &'b StringPattern,
) -> impl Iterator<Item = (&'a str, &'a RefTarget)> + 'b
pub fn local_branches_matching<'a: 'b, 'b>( &'a self, pattern: &'b StringPattern, ) -> impl Iterator<Item = (&'a str, &'a RefTarget)> + 'b
Iterates local branch (name, target)
s matching the given pattern.
Entries are sorted by name
.
pub fn get_local_branch(&self, name: &str) -> &RefTarget
sourcepub fn set_local_branch_target(&mut self, name: &str, target: RefTarget)
pub fn set_local_branch_target(&mut self, name: &str, target: RefTarget)
Sets local branch to point to the given target. If the target is absent, and if no associated remote branches exist, the branch will be removed.
sourcepub fn all_remote_branches(
&self,
) -> impl Iterator<Item = ((&str, &str), &RemoteRef)>
pub fn all_remote_branches( &self, ) -> impl Iterator<Item = ((&str, &str), &RemoteRef)>
Iterates over ((name, remote_name), remote_ref)
for all remote
branches in lexicographical order.
sourcepub fn remote_branches(
&self,
remote_name: &str,
) -> impl Iterator<Item = (&str, &RemoteRef)>
pub fn remote_branches( &self, remote_name: &str, ) -> impl Iterator<Item = (&str, &RemoteRef)>
Iterates over (name, remote_ref)
s for all remote branches of the
specified remote in lexicographical order.
sourcepub fn remote_branches_matching<'a: 'b, 'b>(
&'a self,
branch_pattern: &'b StringPattern,
remote_pattern: &'b StringPattern,
) -> impl Iterator<Item = ((&'a str, &'a str), &'a RemoteRef)> + 'b
pub fn remote_branches_matching<'a: 'b, 'b>( &'a self, branch_pattern: &'b StringPattern, remote_pattern: &'b StringPattern, ) -> impl Iterator<Item = ((&'a str, &'a str), &'a RemoteRef)> + 'b
Iterates over (name, remote_ref)
s for all remote branches of the
specified remote that match the given pattern.
Entries are sorted by (name, remote_name)
.
pub fn get_remote_branch(&self, name: &str, remote_name: &str) -> &RemoteRef
sourcepub fn set_remote_branch(
&mut self,
name: &str,
remote_name: &str,
remote_ref: RemoteRef,
)
pub fn set_remote_branch( &mut self, name: &str, remote_name: &str, remote_ref: RemoteRef, )
Sets remote-tracking branch to the given target and state. If the target is absent, the branch will be removed.
sourcepub fn local_remote_branches<'a>(
&'a self,
remote_name: &str,
) -> impl Iterator<Item = (&'a str, LocalAndRemoteRef<'a>)> + 'a
pub fn local_remote_branches<'a>( &'a self, remote_name: &str, ) -> impl Iterator<Item = (&'a str, LocalAndRemoteRef<'a>)> + 'a
Iterates over (name, {local_ref, remote_ref})
s for every branch
present locally and/or on the specified remote, in lexicographical
order.
Note that this does not take into account whether the local branch tracks the remote branch or not. Missing values are represented as RefTarget::absent_ref() or RemoteRef::absent_ref().
sourcepub fn local_remote_branches_matching<'a: 'b, 'b>(
&'a self,
branch_pattern: &'b StringPattern,
remote_name: &str,
) -> impl Iterator<Item = (&'a str, LocalAndRemoteRef<'a>)> + 'b
pub fn local_remote_branches_matching<'a: 'b, 'b>( &'a self, branch_pattern: &'b StringPattern, remote_name: &str, ) -> impl Iterator<Item = (&'a str, LocalAndRemoteRef<'a>)> + 'b
Iterates over (name, TrackingRefPair {local_ref, remote_ref})
s for
every branch with a name that matches the given pattern, and that is
present locally and/or on the specified remote.
Entries are sorted by name
.
Note that this does not take into account whether the local branch tracks the remote branch or not. Missing values are represented as RefTarget::absent_ref() or RemoteRef::absent_ref().
pub fn remove_remote(&mut self, remote_name: &str)
pub fn rename_remote(&mut self, old: &str, new: &str)
pub fn get_tag(&self, name: &str) -> &RefTarget
sourcepub fn set_tag_target(&mut self, name: &str, target: RefTarget)
pub fn set_tag_target(&mut self, name: &str, target: RefTarget)
Sets tag to point to the given target. If the target is absent, the tag will be removed.
pub fn get_git_ref(&self, name: &str) -> &RefTarget
sourcepub fn set_git_ref_target(&mut self, name: &str, target: RefTarget)
pub fn set_git_ref_target(&mut self, name: &str, target: RefTarget)
Sets the last imported Git ref to point to the given target. If the target is absent, the reference will be removed.
sourcepub fn set_git_head_target(&mut self, target: RefTarget)
pub fn set_git_head_target(&mut self, target: RefTarget)
Sets HEAD@git
to point to the given target. If the target is absent,
the reference will be cleared.
sourcepub fn all_referenced_commit_ids(&self) -> impl Iterator<Item = &CommitId>
pub fn all_referenced_commit_ids(&self) -> impl Iterator<Item = &CommitId>
Iterates all commit ids referenced by this view.
This can include hidden commits referenced by remote branches, previous positions of conflicted branches, etc. The ancestors and predecessors of the returned commits should be considered reachable from the view. Use this to build commit index from scratch.
The iteration order is unspecified, and may include duplicated entries.
pub fn set_view(&mut self, data: View)
pub fn store_view(&self) -> &View
pub fn store_view_mut(&mut self) -> &mut View
Trait Implementations§
impl Eq for View
impl StructuralPartialEq for View
Auto Trait Implementations§
impl Freeze for View
impl RefUnwindSafe for View
impl Send for View
impl Sync for View
impl Unpin for View
impl UnwindSafe for View
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,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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