pub struct MergedTree { /* private fields */ }Expand description
Presents a view of a merged set of trees at the root directory. In the future, this may store additional metadata like conflict labels, so tree IDs should be compared instead when checking for file changes.
Implementations§
Source§impl MergedTree
impl MergedTree
Sourcepub fn resolved(store: Arc<Store>, tree_id: TreeId) -> Self
pub fn resolved(store: Arc<Store>, tree_id: TreeId) -> Self
Creates a MergedTree with the given resolved tree ID.
Sourcepub fn new(store: Arc<Store>, tree_ids: Merge<TreeId>) -> Self
pub fn new(store: Arc<Store>, tree_ids: Merge<TreeId>) -> Self
Creates a MergedTree with the given tree IDs.
Sourcepub fn tree_ids(&self) -> &Merge<TreeId>
pub fn tree_ids(&self) -> &Merge<TreeId>
The underlying tree IDs for this MergedTree. If there are file changes
between two trees, then the tree IDs will be different.
Sourcepub fn into_tree_ids(self) -> Merge<TreeId>
pub fn into_tree_ids(self) -> Merge<TreeId>
Extracts the underlying tree IDs for this MergedTree.
Sourcepub fn trees(&self) -> BackendResult<Merge<Tree>>
pub fn trees(&self) -> BackendResult<Merge<Tree>>
Reads the merge of tree objects represented by this MergedTree.
Sourcepub async fn trees_async(&self) -> BackendResult<Merge<Tree>>
pub async fn trees_async(&self) -> BackendResult<Merge<Tree>>
Async version of trees().
Sourcepub async fn resolve(self) -> BackendResult<Self>
pub async fn resolve(self) -> BackendResult<Self>
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 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 async fn path_value_async(
&self,
path: &RepoPath,
) -> BackendResult<MergedTreeValue>
pub async fn path_value_async( &self, path: &RepoPath, ) -> BackendResult<MergedTreeValue>
Async version of path_value().
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: &Self,
matcher: &'matcher dyn Matcher,
) -> TreeDiffStream<'matcher>
pub fn diff_stream<'matcher>( &self, other: &Self, matcher: &'matcher dyn Matcher, ) -> TreeDiffStream<'matcher>
Stream of the differences between this tree and another tree.
Sourcepub fn diff_stream_for_file_system<'matcher>(
&self,
other: &Self,
matcher: &'matcher dyn Matcher,
) -> TreeDiffStream<'matcher>
pub fn diff_stream_for_file_system<'matcher>( &self, other: &Self, matcher: &'matcher dyn Matcher, ) -> TreeDiffStream<'matcher>
Like diff_stream() but files in a removed tree will be returned before
a file that replaces it.
Sourcepub fn diff_stream_with_copies<'a>(
&self,
other: &Self,
matcher: &'a dyn Matcher,
copy_records: &'a CopyRecords,
) -> BoxStream<'a, CopiesTreeDiffEntry>
pub fn diff_stream_with_copies<'a>( &self, other: &Self, matcher: &'a dyn Matcher, copy_records: &'a CopyRecords, ) -> BoxStream<'a, CopiesTreeDiffEntry>
Like diff_stream() but takes the given copy records into account.
Sourcepub async fn merge(self, base: Self, other: Self) -> BackendResult<Self>
pub async fn merge(self, base: Self, other: Self) -> BackendResult<Self>
Merges this tree with other, using base as base. Any conflicts will
be resolved recursively if possible.
Sourcepub fn merge_no_resolve(self, base: Self, other: Self) -> Self
pub fn merge_no_resolve(self, base: Self, other: Self) -> Self
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 moreAuto 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<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