pub struct MergedTree { /* private fields */ }Expand description
Presents a view of a merged set of trees at the root directory, as well as conflict labels.
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>,
labels: ConflictLabels,
) -> Self
pub fn new( store: Arc<Store>, tree_ids: Merge<TreeId>, labels: ConflictLabels, ) -> 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, discarding any
conflict labels.
Sourcepub fn labels(&self) -> &ConflictLabels
pub fn labels(&self) -> &ConflictLabels
Returns this merge’s conflict labels, if any.
Sourcepub fn tree_ids_and_labels(&self) -> (&Merge<TreeId>, &ConflictLabels)
pub fn tree_ids_and_labels(&self) -> (&Merge<TreeId>, &ConflictLabels)
Returns both the underlying tree IDs and any conflict labels. This can be used to check whether there are changes in files to be materialized in the working copy.
Sourcepub fn into_tree_ids_and_labels(self) -> (Merge<TreeId>, ConflictLabels)
pub fn into_tree_ids_and_labels(self) -> (Merge<TreeId>, ConflictLabels)
Extracts the underlying tree IDs and conflict labels.
Sourcepub async fn trees(&self) -> BackendResult<Merge<Tree>>
pub async fn trees(&self) -> BackendResult<Merge<Tree>>
Reads the merge of tree objects represented by this MergedTree.
Sourcepub fn labels_by_term<'a>(&'a self, label: &'a str) -> Merge<&'a str>
pub fn labels_by_term<'a>(&'a self, label: &'a str) -> Merge<&'a str>
Returns a label for each term in a merge. Resolved merges use the provided label, while conflicted merges keep their original labels. Missing labels are indicated by empty strings.
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 conflicts_matching<'matcher>(
&self,
matcher: &'matcher dyn Matcher,
) -> impl Iterator<Item = (RepoPathBuf, BackendResult<MergedTreeValue>)> + use<'matcher>
pub fn conflicts_matching<'matcher>( &self, matcher: &'matcher dyn Matcher, ) -> impl Iterator<Item = (RepoPathBuf, BackendResult<MergedTreeValue>)> + use<'matcher>
Like conflicts() but restricted by a matcher.
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_with_trees<'matcher>(
&self,
other: &Self,
matcher: &'matcher dyn Matcher,
) -> TreeDiffStream<'matcher>
pub fn diff_stream_with_trees<'matcher>( &self, other: &Self, matcher: &'matcher dyn Matcher, ) -> TreeDiffStream<'matcher>
Like diff_stream() but trees with diffs themselves are also included.
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(merge: Merge<(Self, String)>) -> BackendResult<Self>
pub async fn merge(merge: Merge<(Self, String)>) -> BackendResult<Self>
Merges the provided trees into a single MergedTree. Any conflicts will
be resolved recursively if possible. The provided labels are used if a
conflict arises. However, if one of the input trees is already
conflicted, the corresponding label will be ignored, and its existing
labels will be used instead.
Sourcepub fn merge_no_resolve(merge: Merge<(Self, String)>) -> Self
pub fn merge_no_resolve(merge: Merge<(Self, String)>) -> Self
Merges the provided trees into a single MergedTree, 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