commit: drop merged_ prefix from tree() and tree_id()

The old `tree()` and `tree_id()` functions are now gone, so we can use
those names for the new functions.
This commit is contained in:
Martin von Zweigbergk 2023-08-28 13:09:19 -07:00 committed by Martin von Zweigbergk
parent f54b456e64
commit 145b0b24d8
17 changed files with 81 additions and 84 deletions

View file

@ -806,7 +806,7 @@ impl WorkspaceCommandHelper {
// The working copy was presumably updated by the git command that updated
// HEAD, so we just need to reset our working copy
// state to it without updating working copy files.
let new_git_head_tree = new_git_head_commit.merged_tree()?;
let new_git_head_tree = new_git_head_commit.tree()?;
locked_working_copy.reset(&new_git_head_tree)?;
tx.mut_repo().rebase_descendants(&self.settings)?;
self.user_repo = ReadonlyUserRepo::new(tx.commit());
@ -888,7 +888,7 @@ impl WorkspaceCommandHelper {
&mut self,
) -> Result<(LockedWorkingCopy, Commit), CommandError> {
let (locked_working_copy, wc_commit) = self.unchecked_start_working_copy_mutation()?;
if wc_commit.merged_tree_id() != locked_working_copy.old_tree_id() {
if wc_commit.tree_id() != locked_working_copy.old_tree_id() {
return Err(user_error("Concurrent working copy operation. Try again."));
}
Ok((locked_working_copy, wc_commit))
@ -1305,7 +1305,7 @@ See https://github.com/martinvonz/jj/blob/main/docs/working-copy.md#stale-workin
max_new_file_size: self.settings.max_new_file_size()?,
})?;
drop(progress);
if new_tree_id != *wc_commit.merged_tree_id() {
if new_tree_id != *wc_commit.tree_id() {
let mut tx = start_repo_transaction(
&self.user_repo.repo,
&self.settings,
@ -1672,7 +1672,7 @@ pub fn check_stale_working_copy(
) -> Result<Option<Operation>, StaleWorkingCopyError> {
// Check if the working copy's tree matches the repo's view
let wc_tree_id = locked_wc.old_tree_id();
if wc_commit.merged_tree_id() == wc_tree_id {
if wc_commit.tree_id() == wc_tree_id {
// The working copy isn't stale, and no need to reload the repo.
Ok(None)
} else {
@ -1924,11 +1924,11 @@ pub fn update_working_copy(
old_commit: Option<&Commit>,
new_commit: &Commit,
) -> Result<Option<CheckoutStats>, CommandError> {
let old_tree_id = old_commit.map(|commit| commit.merged_tree_id().clone());
let stats = if Some(new_commit.merged_tree_id()) != old_tree_id.as_ref() {
let old_tree_id = old_commit.map(|commit| commit.tree_id().clone());
let stats = if Some(new_commit.tree_id()) != old_tree_id.as_ref() {
// TODO: CheckoutError::ConcurrentCheckout should probably just result in a
// warning for most commands (but be an error for the checkout command)
let new_tree = new_commit.merged_tree()?;
let new_tree = new_commit.tree()?;
let stats = wc
.check_out(repo.op_id().clone(), old_tree_id.as_ref(), &new_tree)
.map_err(|err| {

View file

@ -905,7 +905,7 @@ fn cmd_git_push(
{
reasons.push("it has no author and/or committer set");
}
if commit.merged_tree()?.has_conflict() {
if commit.tree()?.has_conflict() {
reasons.push("it has conflicts");
}
if !reasons.is_empty() {
@ -1050,7 +1050,7 @@ fn cmd_git_submodule_print_gitmodules(
let workspace_command = command.workspace_helper(ui)?;
let repo = workspace_command.repo();
let commit = workspace_command.resolve_single_rev(&args.revisions, ui)?;
let tree = commit.merged_tree()?;
let tree = commit.tree()?;
let gitmodules_path = RepoPath::from_internal_string(".gitmodules");
let mut gitmodules_file = match tree.path_value(&gitmodules_path).into_resolved() {
Ok(None) => {

View file

@ -1302,7 +1302,7 @@ fn cmd_checkout(
.new_commit(
command.settings(),
vec![target.id().clone()],
target.merged_tree_id().clone(),
target.tree_id().clone(),
)
.set_description(cli_util::join_message_paragraphs(&args.message_paragraphs));
let new_commit = commit_builder.write()?;
@ -1327,8 +1327,8 @@ fn cmd_untrack(
let base_ignores = workspace_command.base_ignores();
let (mut locked_working_copy, wc_commit) = workspace_command.start_working_copy_mutation()?;
// Create a new tree without the unwanted files
let mut tree_builder = MergedTreeBuilder::new(wc_commit.merged_tree_id().clone());
let wc_tree = wc_commit.merged_tree()?;
let mut tree_builder = MergedTreeBuilder::new(wc_commit.tree_id().clone());
let wc_tree = wc_commit.tree()?;
for (path, _value) in wc_tree.entries_matching(matcher.as_ref()) {
tree_builder.set_or_remove(path, Merge::absent());
}
@ -1388,7 +1388,7 @@ Make sure they're ignored, then try again.",
fn cmd_files(ui: &mut Ui, command: &CommandHelper, args: &FilesArgs) -> Result<(), CommandError> {
let workspace_command = command.workspace_helper(ui)?;
let commit = workspace_command.resolve_single_rev(&args.revision, ui)?;
let tree = commit.merged_tree()?;
let tree = commit.tree()?;
let matcher = workspace_command.matcher_from_values(&args.paths)?;
ui.request_pager();
for (name, _value) in tree.entries_matching(matcher.as_ref()) {
@ -1401,7 +1401,7 @@ fn cmd_files(ui: &mut Ui, command: &CommandHelper, args: &FilesArgs) -> Result<(
fn cmd_cat(ui: &mut Ui, command: &CommandHelper, args: &CatArgs) -> Result<(), CommandError> {
let workspace_command = command.workspace_helper(ui)?;
let commit = workspace_command.resolve_single_rev(&args.revision, ui)?;
let tree = commit.merged_tree()?;
let tree = commit.tree()?;
let path = workspace_command.parse_file_path(&args.path)?;
let repo = workspace_command.repo();
match tree.path_value(&path).into_resolved() {
@ -1433,15 +1433,15 @@ fn cmd_diff(ui: &mut Ui, command: &CommandHelper, args: &DiffArgs) -> Result<(),
let to_tree;
if args.from.is_some() || args.to.is_some() {
let from = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"), ui)?;
from_tree = from.merged_tree()?;
from_tree = from.tree()?;
let to = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"), ui)?;
to_tree = to.merged_tree()?;
to_tree = to.tree()?;
} else {
let commit =
workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"), ui)?;
let parents = commit.parents();
from_tree = merge_commit_trees(workspace_command.repo().as_ref(), &parents)?;
to_tree = commit.merged_tree()?
to_tree = commit.tree()?
}
let matcher = workspace_command.matcher_from_values(&args.paths)?;
let diff_formats = diff_util::diff_formats_for(command.settings(), &args.format)?;
@ -1498,7 +1498,7 @@ fn cmd_status(
if let Some(wc_commit) = &maybe_wc_commit {
let parent_tree = merge_commit_trees(repo.as_ref(), &wc_commit.parents())?;
let tree = wc_commit.merged_tree()?;
let tree = wc_commit.tree()?;
if tree.id() == parent_tree.id() {
formatter.write_str("The working copy is clean\n")?;
} else {
@ -1510,7 +1510,7 @@ fn cmd_status(
)?;
}
let conflicts = wc_commit.merged_tree()?.conflicts().collect_vec();
let conflicts = wc_commit.tree()?.conflicts().collect_vec();
if !conflicts.is_empty() {
writeln!(
formatter.labeled("conflict"),
@ -1837,7 +1837,7 @@ fn show_predecessor_patch(
None => return Ok(()),
};
let predecessor_tree = rebase_to_dest_parent(workspace_command, predecessor, commit)?;
let tree = commit.merged_tree()?;
let tree = commit.tree()?;
diff_util::show_diff(
ui,
formatter,
@ -1860,7 +1860,7 @@ fn cmd_interdiff(
let to = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"), ui)?;
let from_tree = rebase_to_dest_parent(&workspace_command, &from, &to)?;
let to_tree = to.merged_tree()?;
let to_tree = to.tree()?;
let matcher = workspace_command.matcher_from_values(&args.paths)?;
let diff_formats = diff_util::diff_formats_for(command.settings(), &args.format)?;
ui.request_pager();
@ -1881,13 +1881,13 @@ fn rebase_to_dest_parent(
destination: &Commit,
) -> Result<MergedTree, CommandError> {
if source.parent_ids() == destination.parent_ids() {
Ok(source.merged_tree()?)
Ok(source.tree()?)
} else {
let destination_parent_tree =
merge_commit_trees(workspace_command.repo().as_ref(), &destination.parents())?;
let source_parent_tree =
merge_commit_trees(workspace_command.repo().as_ref(), &source.parents())?;
let source_tree = source.merged_tree()?;
let source_tree = source.tree()?;
let rebased_tree = destination_parent_tree.merge(&source_parent_tree, &source_tree)?;
Ok(rebased_tree)
}
@ -2074,7 +2074,7 @@ fn cmd_commit(ui: &mut Ui, command: &CommandHelper, args: &CommitArgs) -> Result
.new_commit(
command.settings(),
vec![new_commit.id().clone()],
new_commit.merged_tree_id().clone(),
new_commit.tree_id().clone(),
)
.write()?;
for workspace_id in workspace_ids {
@ -2392,7 +2392,7 @@ fn cmd_move(ui: &mut Ui, command: &CommandHelper, args: &MoveArgs) -> Result<(),
destination.id().hex()
));
let parent_tree = merge_commit_trees(tx.repo(), &source.parents())?;
let source_tree = source.merged_tree()?;
let source_tree = source.tree()?;
let instructions = format!(
"\
You are moving changes from: {}
@ -2443,7 +2443,7 @@ from the source will be moved into the destination.
destination = tx.mut_repo().store().get_commit(&rebased_destination_id)?;
}
// Apply the selected changes onto the destination
let destination_tree = destination.merged_tree()?;
let destination_tree = destination.tree()?;
let new_destination_tree = destination_tree.merge(&parent_tree, &new_parent_tree)?;
let description = combine_messages(
tx.base_repo(),
@ -2491,8 +2491,8 @@ from the source will be moved into the parent.
tx.format_commit_summary(&commit),
tx.format_commit_summary(parent)
);
let parent_tree = parent.merged_tree()?;
let tree = commit.merged_tree()?;
let parent_tree = parent.tree()?;
let tree = commit.tree()?;
let new_parent_tree_id = tx.select_diff(
ui,
&parent_tree,
@ -2501,7 +2501,7 @@ from the source will be moved into the parent.
args.interactive,
matcher.as_ref(),
)?;
if &new_parent_tree_id == parent.merged_tree_id() {
if &new_parent_tree_id == parent.tree_id() {
if args.interactive {
return Err(user_error("No changes selected"));
}
@ -2525,7 +2525,7 @@ from the source will be moved into the parent.
}
// Abandon the child if the parent now has all the content from the child
// (always the case in the non-interactive case).
let abandon_child = &new_parent_tree_id == commit.merged_tree_id();
let abandon_child = &new_parent_tree_id == commit.tree_id();
let description = if !args.message_paragraphs.is_empty() {
cli_util::join_message_paragraphs(&args.message_paragraphs)
} else {
@ -2592,7 +2592,7 @@ aborted.
tx.format_commit_summary(parent),
tx.format_commit_summary(&commit)
);
let parent_tree = parent.merged_tree()?;
let parent_tree = parent.tree()?;
new_parent_tree_id = tx.edit_diff(ui, &parent_base_tree, &parent_tree, &instructions)?;
if new_parent_tree_id == parent_base_tree.id() {
return Err(user_error("No changes selected"));
@ -2654,9 +2654,9 @@ fn cmd_chmod(ui: &mut Ui, command: &CommandHelper, args: &ChmodArgs) -> Result<(
},
commit.id().hex(),
));
let tree = commit.merged_tree()?;
let tree = commit.tree()?;
let store = tree.store();
let mut tree_builder = MergedTreeBuilder::new(commit.merged_tree_id().clone());
let mut tree_builder = MergedTreeBuilder::new(commit.tree_id().clone());
for repo_path in repo_paths {
let user_error_with_path = |msg: &str| {
user_error(format!(
@ -2711,7 +2711,7 @@ fn cmd_resolve(
let mut workspace_command = command.workspace_helper(ui)?;
let matcher = workspace_command.matcher_from_values(&args.paths)?;
let commit = workspace_command.resolve_single_rev(&args.revision, ui)?;
let tree = commit.merged_tree()?;
let tree = commit.tree()?;
let conflicts = tree
.conflicts()
.filter(|path| matcher.matches(&path.0))
@ -2749,7 +2749,7 @@ fn cmd_resolve(
tx.finish(ui)?;
if !args.quiet {
let new_tree = new_commit.merged_tree()?;
let new_tree = new_commit.tree()?;
let new_conflicts = new_tree.conflicts().collect_vec();
if !new_conflicts.is_empty() {
ui.write("After this operation, some files at this revision still have conflicts:\n")?;
@ -2873,7 +2873,7 @@ fn cmd_restore(
to_commit = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"), ui)?;
from_tree = workspace_command
.resolve_single_rev(args.from.as_deref().unwrap_or("@"), ui)?
.merged_tree()?;
.tree()?;
} else {
to_commit =
workspace_command.resolve_single_rev(args.changes_in.as_deref().unwrap_or("@"), ui)?;
@ -2885,14 +2885,14 @@ fn cmd_restore(
from_tree.id().clone()
} else {
let matcher = workspace_command.matcher_from_values(&args.paths)?;
let mut tree_builder = MergedTreeBuilder::new(to_commit.merged_tree_id().clone());
let to_tree = to_commit.merged_tree()?;
let mut tree_builder = MergedTreeBuilder::new(to_commit.tree_id().clone());
let to_tree = to_commit.tree()?;
for (repo_path, before, _after) in from_tree.diff(&to_tree, matcher.as_ref()) {
tree_builder.set_or_remove(repo_path, before);
}
tree_builder.write_tree(workspace_command.repo().store())?
};
if &new_tree_id == to_commit.merged_tree_id() {
if &new_tree_id == to_commit.tree_id() {
ui.write("Nothing changed.\n")?;
} else {
let mut tx = workspace_command
@ -2949,9 +2949,9 @@ don't make any changes, then the operation will be aborted.",
tx.format_commit_summary(&target_commit),
);
let base_tree = merge_commit_trees(tx.repo(), base_commits.as_slice())?;
let tree = target_commit.merged_tree()?;
let tree = target_commit.tree()?;
let tree_id = tx.edit_diff(ui, &base_tree, &tree, &instructions)?;
if tree_id == *target_commit.merged_tree_id() {
if tree_id == *target_commit.tree_id() {
ui.write("Nothing changed.\n")?;
} else {
let mut_repo = tx.mut_repo();
@ -3038,7 +3038,7 @@ fn cmd_split(ui: &mut Ui, command: &CommandHelper, args: &SplitArgs) -> Result<(
let matcher = workspace_command.matcher_from_values(&args.paths)?;
let mut tx =
workspace_command.start_transaction(&format!("split commit {}", commit.id().hex()));
let end_tree = commit.merged_tree()?;
let end_tree = commit.tree()?;
let base_tree = merge_commit_trees(tx.repo(), &commit.parents())?;
let interactive = args.paths.is_empty();
let instructions = format!(
@ -3061,7 +3061,7 @@ don't make any changes, then the operation will be aborted.
interactive,
matcher.as_ref(),
)?;
if &tree_id == commit.merged_tree_id() && interactive {
if &tree_id == commit.tree_id() && interactive {
ui.write("Nothing changed.\n")?;
return Ok(());
}
@ -3109,7 +3109,7 @@ don't make any changes, then the operation will be aborted.
.mut_repo()
.rewrite_commit(command.settings(), &commit)
.set_parents(vec![first_commit.id().clone()])
.set_tree_id(commit.merged_tree_id().clone())
.set_tree_id(commit.tree_id().clone())
.generate_new_change_id()
.set_description(second_description)
.write()?;
@ -3600,10 +3600,10 @@ fn cmd_workspace_update_stale(
Err(_) => {
// The same check as start_working_copy_mutation(), but with the stale
// working-copy commit.
if known_wc_commit.merged_tree_id() != locked_wc.old_tree_id() {
if known_wc_commit.tree_id() != locked_wc.old_tree_id() {
return Err(user_error("Concurrent working copy operation. Try again."));
}
let desired_tree = desired_wc_commit.merged_tree()?;
let desired_tree = desired_wc_commit.tree()?;
let stats = locked_wc.check_out(&desired_tree).map_err(|err| {
CommandError::InternalError(format!(
"Failed to check out commit {}: {}",

View file

@ -300,11 +300,11 @@ fn build_commit_keyword_opt<'repo>(
maybe_entries.map_or(true, |entries| !entries.contains(commit.id()))
})),
"conflict" => language.wrap_boolean(wrap_fn(property, |commit| {
commit.merged_tree().unwrap().has_conflict()
commit.tree().unwrap().has_conflict()
})),
"empty" => language.wrap_boolean(wrap_fn(property, |commit| {
let parent_tree = rewrite::merge_commit_trees(repo, &commit.parents()).unwrap();
*commit.merged_tree_id() == parent_tree.id()
*commit.tree_id() == parent_tree.id()
})),
"root" => language.wrap_boolean(wrap_fn(property, move |commit| {
commit.id() == repo.store().root_commit_id()

View file

@ -204,7 +204,7 @@ pub fn show_patch(
) -> Result<(), CommandError> {
let parents = commit.parents();
let from_tree = rewrite::merge_commit_trees(workspace_command.repo().as_ref(), &parents)?;
let to_tree = commit.merged_tree()?;
let to_tree = commit.tree()?;
show_diff(
ui,
formatter,

View file

@ -100,11 +100,11 @@ impl Commit {
.collect()
}
pub fn merged_tree(&self) -> Result<MergedTree, BackendError> {
pub fn tree(&self) -> Result<MergedTree, BackendError> {
self.store.get_root_tree(&self.data.root_tree)
}
pub fn merged_tree_id(&self) -> &MergedTreeId {
pub fn tree_id(&self) -> &MergedTreeId {
&self.data.root_tree
}
@ -133,7 +133,7 @@ impl Commit {
pub fn is_discardable(&self) -> bool {
if self.description().is_empty() {
if let [parent_commit] = &*self.parents() {
return self.merged_tree_id() == parent_commit.merged_tree_id();
return self.tree_id() == parent_commit.tree_id();
}
}
false

View file

@ -869,7 +869,7 @@ fn build_predicate_fn<'index>(
}
RevsetFilterPredicate::HasConflict => pure_predicate_fn(move |entry| {
let commit = store.get_commit(&entry.commit_id()).unwrap();
commit.merged_tree().unwrap().has_conflict()
commit.tree().unwrap().has_conflict()
}),
}
}
@ -884,7 +884,7 @@ fn has_diff_from_parent(
let parents = commit.parents();
if let [parent] = parents.as_slice() {
// Fast path: no need to load the root tree
let unchanged = commit.merged_tree_id() == parent.merged_tree_id();
let unchanged = commit.tree_id() == parent.tree_id();
if matcher.visit(&RepoPath::root()) == Visit::AllRecursively {
return !unchanged;
} else if unchanged {
@ -892,7 +892,7 @@ fn has_diff_from_parent(
}
}
let from_tree = rewrite::merge_commit_trees_without_repo(store, &index, &parents).unwrap();
let to_tree = commit.merged_tree().unwrap();
let to_tree = commit.tree().unwrap();
from_tree.diff(&to_tree, matcher).next().is_some()
}

View file

@ -856,7 +856,7 @@ impl MutableRepo {
.new_commit(
settings,
vec![commit.id().clone()],
commit.merged_tree_id().clone(),
commit.tree_id().clone(),
)
.write()?;
self.edit(workspace_id, &wc_commit)?;

View file

@ -50,7 +50,7 @@ pub fn merge_commit_trees_without_repo(
if commits.is_empty() {
Ok(store.get_root_tree(&MergedTreeId::Legacy(store.empty_tree_id().clone()))?)
} else {
let mut new_tree = commits[0].merged_tree()?;
let mut new_tree = commits[0].tree()?;
let commit_ids = commits
.iter()
.map(|commit| commit.id().clone())
@ -62,7 +62,7 @@ pub fn merge_commit_trees_without_repo(
.map(|id| store.get_commit(id))
.try_collect()?;
let ancestor_tree = merge_commit_trees_without_repo(store, index, &ancestors)?;
let other_tree = other_commit.merged_tree()?;
let other_tree = other_commit.tree()?;
new_tree = new_tree.merge(&ancestor_tree, &other_tree)?;
}
Ok(new_tree)
@ -86,11 +86,11 @@ pub fn rebase_commit(
.collect_vec();
let new_tree_id = if new_parent_trees == old_parent_trees {
// Optimization
old_commit.merged_tree_id().clone()
old_commit.tree_id().clone()
} else {
let old_base_tree = merge_commit_trees(mut_repo, &old_parents)?;
let new_base_tree = merge_commit_trees(mut_repo, new_parents)?;
let old_tree = old_commit.merged_tree()?;
let old_tree = old_commit.tree()?;
let merged_tree = new_base_tree.merge(&old_base_tree, &old_tree)?;
merged_tree.id()
};
@ -113,7 +113,7 @@ pub fn back_out_commit(
) -> Result<Commit, TreeMergeError> {
let old_base_tree = merge_commit_trees(mut_repo, &old_commit.parents())?;
let new_base_tree = merge_commit_trees(mut_repo, new_parents)?;
let old_tree = old_commit.merged_tree()?;
let old_tree = old_commit.tree()?;
let new_tree = new_base_tree.merge(&old_tree, &old_base_tree)?;
let new_parent_ids = new_parents
.iter()
@ -358,7 +358,7 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> {
.new_commit(
self.settings,
vec![new_commit.id().clone()],
new_commit.merged_tree_id().clone(),
new_commit.tree_id().clone(),
)
.write()?
};

View file

@ -81,9 +81,9 @@ fn test_initial(use_git: bool) {
assert_eq!(
store
.root_commit()
.merged_tree()
.tree()
.unwrap()
.diff_summary(&commit.merged_tree().unwrap(), &EverythingMatcher),
.diff_summary(&commit.tree().unwrap(), &EverythingMatcher),
DiffSummary {
modified: vec![],
added: vec![dir_file_path, root_file_path],
@ -165,9 +165,9 @@ fn test_rewrite(use_git: bool) {
assert_eq!(
store
.root_commit()
.merged_tree()
.tree()
.unwrap()
.diff_summary(&rewritten_commit.merged_tree().unwrap(), &EverythingMatcher),
.diff_summary(&rewritten_commit.tree().unwrap(), &EverythingMatcher),
DiffSummary {
modified: vec![],
added: vec![dir_file_path.clone(), root_file_path],
@ -176,9 +176,9 @@ fn test_rewrite(use_git: bool) {
);
assert_eq!(
initial_commit
.merged_tree()
.tree()
.unwrap()
.diff_summary(&rewritten_commit.merged_tree().unwrap(), &EverythingMatcher),
.diff_summary(&rewritten_commit.tree().unwrap(), &EverythingMatcher),
DiffSummary {
modified: vec![dir_file_path],
added: vec![],

View file

@ -2100,7 +2100,7 @@ fn test_rewrite_imported_commit() {
.new_commit(
&settings,
imported_commit.parent_ids().to_vec(),
imported_commit.merged_tree_id().clone(),
imported_commit.tree_id().clone(),
)
.set_author(imported_commit.author().clone())
.set_committer(imported_commit.committer().clone())

View file

@ -125,7 +125,7 @@ fn test_init_checkout(use_git: bool) {
.unwrap();
let wc_commit = repo.store().get_commit(wc_commit_id).unwrap();
assert_eq!(
*wc_commit.merged_tree_id(),
*wc_commit.tree_id(),
MergedTreeId::Legacy(repo.store().empty_tree_id().clone())
);
assert_eq!(

View file

@ -604,8 +604,8 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) {
rebase_commit(&settings, tx.mut_repo(), &commit_c, &[commit_b2.clone()]).unwrap();
// Test the setup: Both B and C should have conflicts.
let tree_b2 = commit_b2.merged_tree().unwrap();
let tree_c2 = commit_b2.merged_tree().unwrap();
let tree_b2 = commit_b2.tree().unwrap();
let tree_c2 = commit_b2.tree().unwrap();
assert!(!tree_b2.path_value(&path).is_resolved());
assert!(!tree_c2.path_value(&path).is_resolved());
@ -622,7 +622,7 @@ fn test_simplify_conflict_after_resolving_parent(use_git: bool) {
let repo = tx.commit();
// The conflict should now be resolved.
let tree_c2 = commit_c3.merged_tree().unwrap();
let tree_c2 = commit_c3.tree().unwrap();
let resolved_value = tree_c2.path_value(&path);
match resolved_value.into_resolved() {
Ok(Some(TreeValue::File {

View file

@ -58,10 +58,7 @@ fn test_checkout(use_git: bool) {
.mut_repo()
.check_out(ws_id.clone(), &settings, &wc_commit_parent)
.unwrap();
assert_eq!(
wc_commit.merged_tree_id(),
wc_commit_parent.merged_tree_id()
);
assert_eq!(wc_commit.tree_id(), wc_commit_parent.tree_id());
assert_eq!(wc_commit.parents().len(), 1);
assert_eq!(wc_commit.parents()[0].id(), wc_commit_parent.id());
let repo = tx.commit();
@ -210,7 +207,7 @@ fn test_checkout_previous_empty_non_head(use_git: bool) {
.new_commit(
&settings,
vec![old_wc_commit.id().clone()],
old_wc_commit.merged_tree_id().clone(),
old_wc_commit.tree_id().clone(),
)
.write()
.unwrap();

View file

@ -2726,7 +2726,7 @@ fn test_change_id_index() {
.new_commit(
&settings,
vec![root_commit.id().clone()],
root_commit.merged_tree_id().clone(),
root_commit.tree_id().clone(),
)
.set_change_id(ChangeId::from_hex(change_id))
.set_description(format!("commit {commit_number}"))

View file

@ -905,10 +905,10 @@ fn test_rebase_descendants_contents(use_git: bool) {
.get_commit(rebased.get(commit_c.id()).unwrap())
.unwrap();
let tree_b = commit_b.merged_tree().unwrap();
let tree_c = commit_c.merged_tree().unwrap();
let tree_d = commit_d.merged_tree().unwrap();
let new_tree_c = new_commit_c.merged_tree().unwrap();
let tree_b = commit_b.tree().unwrap();
let tree_c = commit_c.tree().unwrap();
let tree_d = commit_d.tree().unwrap();
let new_tree_c = new_commit_c.tree().unwrap();
assert_eq!(new_tree_c.path_value(&path3), tree_c.path_value(&path3));
assert_eq!(new_tree_c.path_value(&path4), tree_d.path_value(&path4));
assert_ne!(new_tree_c.path_value(&path2), tree_b.path_value(&path2));

View file

@ -54,7 +54,7 @@ fn test_root(use_git: bool) {
.get_wc_commit_id(&WorkspaceId::default())
.unwrap();
let wc_commit = repo.store().get_commit(wc_commit_id).unwrap();
assert_eq!(new_tree.id(), *wc_commit.merged_tree_id());
assert_eq!(new_tree.id(), *wc_commit.tree_id());
assert_eq!(
new_tree.id().as_legacy_tree_id(),
repo.store().empty_tree_id()