mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-06 03:22:59 +00:00
tree: leverage trivial_merge()
in merge_trees()
This commit is contained in:
parent
ef7b831411
commit
451af92912
1 changed files with 3 additions and 5 deletions
|
@ -28,6 +28,7 @@ use crate::backend::{
|
||||||
};
|
};
|
||||||
use crate::files::MergeResult;
|
use crate::files::MergeResult;
|
||||||
use crate::matchers::{EverythingMatcher, Matcher};
|
use crate::matchers::{EverythingMatcher, Matcher};
|
||||||
|
use crate::merge::trivial_merge;
|
||||||
use crate::repo_path::{RepoPath, RepoPathComponent, RepoPathJoin};
|
use crate::repo_path::{RepoPath, RepoPathComponent, RepoPathJoin};
|
||||||
use crate::store::Store;
|
use crate::store::Store;
|
||||||
use crate::{backend, files};
|
use crate::{backend, files};
|
||||||
|
@ -534,11 +535,8 @@ pub fn merge_trees(
|
||||||
assert_eq!(side1_tree.dir(), dir);
|
assert_eq!(side1_tree.dir(), dir);
|
||||||
assert_eq!(side2_tree.dir(), dir);
|
assert_eq!(side2_tree.dir(), dir);
|
||||||
|
|
||||||
if base_tree.id() == side1_tree.id() {
|
if let Some(resolved) = trivial_merge(&[&base_tree.id], &[&side1_tree.id, &side2_tree.id]) {
|
||||||
return Ok(side2_tree.id().clone());
|
return Ok(resolved.clone());
|
||||||
}
|
|
||||||
if base_tree.id() == side2_tree.id() || side1_tree.id() == side2_tree.id() {
|
|
||||||
return Ok(side1_tree.id().clone());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start with a tree identical to side 1 and modify based on changes from base
|
// Start with a tree identical to side 1 and modify based on changes from base
|
||||||
|
|
Loading…
Reference in a new issue