pub enum MergedTree {
    Legacy(Tree),
    Merge(Merge<Tree>),
}
Expand description

Presents a view of a merged set of trees.

Variants§

§

Legacy(Tree)

A single tree, possibly with path-level conflicts.

§

Merge(Merge<Tree>)

A merge of multiple trees, or just a single tree. The individual trees have no path-level conflicts.

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 legacy(tree: Tree) -> Self

Creates a new MergedTree backed by a tree with path-level 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 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) -> MergedTreeValue<'_>

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) -> Result<Merge<Tree>, TreeMergeError>

Tries to resolve any conflicts, resolving any conflicts that can be automatically resolved and leaving the rest unresolved. The returned conflict will either be resolved or have the same number of sides as the input.

source

pub fn conflicts( &self ) -> impl Iterator<Item = (RepoPath, Merge<Option<TreeValue>>)>

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) -> 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) -> Merge<Option<TreeValue>>

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 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<'matcher>( &self, other: &MergedTree, matcher: &'matcher dyn Matcher ) -> TreeDiffIterator<'matcher>

Iterate over 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_summary( &self, other: &MergedTree, matcher: &dyn Matcher ) -> DiffSummary

Collects lists of modified, added, and removed files between this tree and another tree.

source

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

Merges this tree with other, using base as base.

Trait Implementations§

source§

impl Clone for MergedTree

source§

fn clone(&self) -> MergedTree

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

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 MergedTree

source§

impl StructuralEq for MergedTree

source§

impl StructuralPartialEq for MergedTree

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

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

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

§

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