Struct jj_lib::view::View

source ·
pub struct View { /* private fields */ }
Expand description

A wrapper around op_store::View that defines additional methods.

Implementations§

source§

impl View

source

pub fn new(op_store_view: View) -> Self

source

pub fn wc_commit_ids(&self) -> &HashMap<WorkspaceId, CommitId>

source

pub fn get_wc_commit_id(&self, workspace_id: &WorkspaceId) -> Option<&CommitId>

source

pub fn workspaces_for_wc_commit_id( &self, commit_id: &CommitId ) -> Vec<WorkspaceId>

source

pub fn is_wc_commit_id(&self, commit_id: &CommitId) -> bool

source

pub fn heads(&self) -> &HashSet<CommitId>

source

pub fn branches(&self) -> impl Iterator<Item = (&str, BranchTarget<'_>)>

Iterates pair of local and remote branches by branch name.

source

pub fn tags(&self) -> &BTreeMap<String, RefTarget>

source

pub fn git_refs(&self) -> &BTreeMap<String, RefTarget>

source

pub fn git_head(&self) -> &RefTarget

source

pub fn set_wc_commit(&mut self, workspace_id: WorkspaceId, commit_id: CommitId)

source

pub fn remove_wc_commit(&mut self, workspace_id: &WorkspaceId)

source

pub fn add_head(&mut self, head_id: &CommitId)

source

pub fn remove_head(&mut self, head_id: &CommitId)

source

pub fn has_branch(&self, name: &str) -> bool

Returns true if any local or remote branch of the given name exists.

source

pub fn remove_branch(&mut self, name: &str)

source

pub fn local_branches(&self) -> impl Iterator<Item = (&str, &RefTarget)>

Iterates local branch (name, target)s in lexicographical order.

source

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.

source

pub fn get_local_branch(&self, name: &str) -> &RefTarget

source

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.

source

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.

source

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.

source

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).

source

pub fn get_remote_branch(&self, name: &str, remote_name: &str) -> &RemoteRef

source

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.

source

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().

source

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().

source

pub fn remove_remote(&mut self, remote_name: &str)

source

pub fn rename_remote(&mut self, old: &str, new: &str)

source

pub fn get_tag(&self, name: &str) -> &RefTarget

source

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.

source

pub fn get_git_ref(&self, name: &str) -> &RefTarget

source

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.

source

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.

source

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.

source

pub fn set_view(&mut self, data: View)

source

pub fn store_view(&self) -> &View

source

pub fn store_view_mut(&mut self) -> &mut View

Trait Implementations§

source§

impl Clone for View

source§

fn clone(&self) -> View

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for View

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for View

source§

fn eq(&self, other: &View) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for View

source§

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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more