Struct MergedTree

Source
pub struct MergedTree { /* private fields */ }
Expand description

Presents a view of a merged set of trees.

Implementations§

Source§

impl MergedTree

Source

pub fn resolved(tree: Tree) -> Self

Creates a new MergedTree representing a single tree without conflicts.

Source

pub fn new(trees: Merge<Tree>) -> Self

Creates a new MergedTree representing a merge of a set of trees. The individual trees must not have any conflicts.

Source

pub fn from_legacy_tree(tree: Tree) -> BackendResult<Self>

Takes a tree in the legacy format (with path-level conflicts in the tree) and returns a MergedTree with any conflicts converted to tree-level conflicts.

Source

pub fn as_merge(&self) -> &Merge<Tree>

Returns the underlying Merge<Tree>.

Source

pub fn take(self) -> Merge<Tree>

Extracts the underlying Merge<Tree>.

Source

pub fn dir(&self) -> &RepoPath

This tree’s directory

Source

pub fn store(&self) -> &Arc<Store>

The Store associated with this tree.

Source

pub fn names<'a>( &'a self, ) -> Box<dyn Iterator<Item = &'a RepoPathComponent> + 'a>

Base names of entries in this directory.

Source

pub fn value(&self, basename: &RepoPathComponent) -> MergedTreeVal<'_>

The value at the given basename. The value can be Resolved even if self is a Merge, which happens if the value at the path can be trivially merged. Does not recurse, so if basename refers to a Tree, then a TreeValue::Tree will be returned.

Source

pub fn resolve(&self) -> BackendResult<MergedTree>

Tries to resolve any conflicts, resolving any conflicts that can be automatically resolved and leaving the rest unresolved.

Source

pub fn conflicts( &self, ) -> impl Iterator<Item = (RepoPathBuf, BackendResult<MergedTreeValue>)> + use<>

An iterator over the conflicts in this tree, including subtrees. Recurses into subtrees and yields conflicts in those, but only if all sides are trees, so tree/file conflicts will be reported as a single conflict, not one for each path in the tree.

Source

pub fn has_conflict(&self) -> bool

Whether this tree has conflicts.

Source

pub fn sub_tree( &self, name: &RepoPathComponent, ) -> BackendResult<Option<MergedTree>>

Gets the MergeTree in a subdirectory of the current tree. If the path doesn’t correspond to a tree in any of the inputs to the merge, then that entry will be replace by an empty tree in the result.

Source

pub fn path_value(&self, path: &RepoPath) -> BackendResult<MergedTreeValue>

The value at the given path. The value can be Resolved even if self is a Conflict, which happens if the value at the path can be trivially merged.

Source

pub fn id(&self) -> MergedTreeId

The tree’s id

Source

pub fn sub_tree_recursive( &self, path: &RepoPath, ) -> BackendResult<Option<MergedTree>>

Look up the tree at the given path.

Source

pub fn entries(&self) -> TreeEntriesIterator<'static>

Iterator over the entries matching the given matcher. Subtrees are visited recursively. Subtrees that differ between the current MergedTree’s terms are merged on the fly. Missing terms are treated as empty directories. Subtrees that conflict with non-trees are not visited. For example, if current tree is a merge of 3 trees, and the entry for ‘foo’ is a conflict between a change subtree and a symlink (i.e. the subdirectory was replaced by symlink in one side of the conflict), then the entry for foo itself will be emitted, but no entries from inside foo/ from either of the trees will be.

Source

pub fn entries_matching<'matcher>( &self, matcher: &'matcher dyn Matcher, ) -> TreeEntriesIterator<'matcher>

Like entries() but restricted by a matcher.

Source

pub fn diff_stream<'matcher>( &self, other: &MergedTree, matcher: &'matcher dyn Matcher, ) -> TreeDiffStream<'matcher>

Stream of the differences between this tree and another tree.

The files in a removed tree will be returned before a file that replaces it.

Source

pub fn diff_stream_with_copies<'a>( &self, other: &MergedTree, matcher: &'a dyn Matcher, copy_records: &'a CopyRecords, ) -> BoxStream<'a, CopiesTreeDiffEntry>

Like diff_stream() but takes the given copy records into account.

Source

pub fn merge( &self, base: &MergedTree, other: &MergedTree, ) -> BackendResult<MergedTree>

Merges this tree with other, using base as base. Any conflicts will be resolved recursively if possible.

Source

pub fn merge_no_resolve( &self, base: &MergedTree, other: &MergedTree, ) -> MergedTree

Merges this tree with other, using base as base, without attempting to resolve file conflicts.

Trait Implementations§

Source§

impl Clone for MergedTree

Source§

fn clone(&self) -> MergedTree

Returns a duplicate 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 MergedTree

Source§

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

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

impl PartialEq for MergedTree

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for MergedTree

Source§

impl StructuralPartialEq for MergedTree

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

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

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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

impl<T> ErasedDestructor for T
where T: 'static,