mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-26 14:06:13 +00:00
merged_tree: leverage .to_tree_merge() in TreeDiffIterator
This commit is contained in:
parent
6fc7cec4a5
commit
19b62d29ba
1 changed files with 2 additions and 13 deletions
|
@ -622,25 +622,14 @@ impl<'matcher> TreeDiffIterator<'matcher> {
|
|||
}
|
||||
}
|
||||
|
||||
fn single_tree(
|
||||
store: &Arc<Store>,
|
||||
dir: &RepoPath,
|
||||
value: Option<&TreeValue>,
|
||||
) -> BackendResult<Tree> {
|
||||
match value {
|
||||
Some(TreeValue::Tree(tree_id)) => store.get_tree(dir, tree_id),
|
||||
_ => Ok(Tree::null(store.clone(), dir.to_owned())),
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets the given tree if `value` is a tree, otherwise an empty tree.
|
||||
fn trees(
|
||||
store: &Arc<Store>,
|
||||
dir: &RepoPath,
|
||||
values: &MergedTreeValue,
|
||||
) -> BackendResult<Merge<Tree>> {
|
||||
if values.is_tree() {
|
||||
values.try_map(|value| Self::single_tree(store, dir, value.as_ref()))
|
||||
if let Some(trees) = values.to_tree_merge(store, dir)? {
|
||||
Ok(trees)
|
||||
} else {
|
||||
Ok(Merge::resolved(Tree::null(store.clone(), dir.to_owned())))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue