pub struct MergedTree { /* private fields */ }
Expand description
Presents a view of a merged set of trees.
Implementations§
Source§impl MergedTree
impl MergedTree
Sourcepub fn resolved(tree: Tree) -> Self
pub fn resolved(tree: Tree) -> Self
Creates a new MergedTree
representing a single tree without conflicts.
Sourcepub fn new(trees: Merge<Tree>) -> Self
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.
Sourcepub fn from_legacy_tree(tree: Tree) -> BackendResult<Self>
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.
Sourcepub fn names<'a>(
&'a self,
) -> Box<dyn Iterator<Item = &'a RepoPathComponent> + 'a>
pub fn names<'a>( &'a self, ) -> Box<dyn Iterator<Item = &'a RepoPathComponent> + 'a>
Base names of entries in this directory.
Sourcepub fn value(&self, basename: &RepoPathComponent) -> MergedTreeVal<'_>
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.
Sourcepub fn resolve(&self) -> BackendResult<MergedTree>
pub fn resolve(&self) -> BackendResult<MergedTree>
Tries to resolve any conflicts, resolving any conflicts that can be automatically resolved and leaving the rest unresolved.
Sourcepub fn conflicts(
&self,
) -> impl Iterator<Item = (RepoPathBuf, BackendResult<MergedTreeValue>)> + use<>
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.
Sourcepub fn has_conflict(&self) -> bool
pub fn has_conflict(&self) -> bool
Whether this tree has conflicts.
Sourcepub fn sub_tree(
&self,
name: &RepoPathComponent,
) -> BackendResult<Option<MergedTree>>
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.
Sourcepub fn path_value(&self, path: &RepoPath) -> BackendResult<MergedTreeValue>
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.
Sourcepub fn id(&self) -> MergedTreeId
pub fn id(&self) -> MergedTreeId
The tree’s id
Sourcepub fn sub_tree_recursive(
&self,
path: &RepoPath,
) -> BackendResult<Option<MergedTree>>
pub fn sub_tree_recursive( &self, path: &RepoPath, ) -> BackendResult<Option<MergedTree>>
Look up the tree at the given path.
Sourcepub fn entries(&self) -> TreeEntriesIterator<'static> ⓘ
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.
Sourcepub fn entries_matching<'matcher>(
&self,
matcher: &'matcher dyn Matcher,
) -> TreeEntriesIterator<'matcher> ⓘ
pub fn entries_matching<'matcher>( &self, matcher: &'matcher dyn Matcher, ) -> TreeEntriesIterator<'matcher> ⓘ
Like entries()
but restricted by a matcher.
Sourcepub fn diff_stream<'matcher>(
&self,
other: &MergedTree,
matcher: &'matcher dyn Matcher,
) -> TreeDiffStream<'matcher>
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.
Sourcepub fn diff_stream_with_copies<'a>(
&self,
other: &MergedTree,
matcher: &'a dyn Matcher,
copy_records: &'a CopyRecords,
) -> BoxStream<'a, CopiesTreeDiffEntry>
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.
Sourcepub fn merge(
&self,
base: &MergedTree,
other: &MergedTree,
) -> BackendResult<MergedTree>
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.
Sourcepub fn merge_no_resolve(
&self,
base: &MergedTree,
other: &MergedTree,
) -> MergedTree
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
impl Clone for MergedTree
Source§fn clone(&self) -> MergedTree
fn clone(&self) -> MergedTree
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MergedTree
impl Debug for MergedTree
Source§impl PartialEq for MergedTree
impl PartialEq for MergedTree
impl Eq for MergedTree
impl StructuralPartialEq for MergedTree
Auto Trait Implementations§
impl Freeze for MergedTree
impl !RefUnwindSafe for MergedTree
impl Send for MergedTree
impl Sync for MergedTree
impl Unpin for MergedTree
impl !UnwindSafe for MergedTree
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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