Skip to content

Commit

Permalink
Make tree-level-conflicts the default in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed May 24, 2024
1 parent 22ac170 commit 14e598e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 0 additions & 3 deletions cli/src/config/misc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ amend = ["squash"]
co = ["checkout"]
unamend = ["unsquash"]

[format]
tree-level-conflicts = true

[ui]
allow-filesets = false
always-allow-large-revsets = false
Expand Down
2 changes: 1 addition & 1 deletion lib/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl UserSettings {
pub fn use_tree_conflict_format(&self) -> bool {
self.config
.get_bool("format.tree-level-conflicts")
.unwrap_or(false)
.unwrap_or(true)
}

pub fn user_name(&self) -> String {
Expand Down
10 changes: 8 additions & 2 deletions lib/tests/test_merged_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use jj_lib::repo::Repo;
use jj_lib::repo_path::{RepoPath, RepoPathComponent};
use jj_lib::tree::merge_trees;
use pretty_assertions::assert_eq;
use testutils::{create_single_tree, write_file, TestRepo};
use testutils::{create_single_tree, user_settings_with_extra_config, write_file, TestRepo};

fn file_value(file_id: &FileId) -> TreeValue {
TreeValue::File {
Expand All @@ -50,7 +50,12 @@ fn diff_stream_equals_iter(tree1: &MergedTree, tree2: &MergedTree, matcher: &dyn

#[test]
fn test_from_legacy_tree() {
let test_repo = TestRepo::init();
// TODO: Find out why this test does not works with tree-level conflicts
let test_repo =
TestRepo::init_with_settings(&user_settings_with_extra_config(config::File::from_str(
"format.tree-level-conflicts=false",
config::FileFormat::Toml,
)));
let repo = &test_repo.repo;
let store = repo.store();

Expand Down Expand Up @@ -218,6 +223,7 @@ fn test_from_legacy_tree() {
tree_builder.set_or_remove(path, Merge::normal(value));
}
let recreated_legacy_id = tree_builder.write_tree(store).unwrap();
// TODO FIXME
assert_eq!(recreated_legacy_id, MergedTreeId::Legacy(tree_id.clone()));

// Create the merged tree by starting from an empty merged tree and adding
Expand Down
7 changes: 7 additions & 0 deletions lib/testutils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ pub fn user_settings() -> UserSettings {
UserSettings::from_config(config)
}

pub fn user_settings_with_extra_config(
extra_source: impl config::Source + Send + Sync + 'static,
) -> UserSettings {
let config = base_config().add_source(extra_source).build().unwrap();
UserSettings::from_config(config)
}

pub struct TestRepo {
_temp_dir: TempDir,
pub repo: Arc<ReadonlyRepo>,
Expand Down

0 comments on commit 14e598e

Please sign in to comment.