Skip to content

Commit

Permalink
cli: enable tree-level conflicts by default
Browse files Browse the repository at this point in the history
I have used the tree-level conflict format for several weeks without
problem (after the fix in 51b5d16). Now - right after the 0.10.0
release - seems like a good time to enable the config by default.

I enabled the config in our default configs in the CLI crate to reduce
impact on tests (compared to changing the default in `settings.rs`).
  • Loading branch information
martinvonz committed Oct 5, 2023
1 parent ce93350 commit 0027159
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 44 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Breaking changes

* Conflicts are now stored in a different way. Commits written by a new `jj`
binary will not be read correctly by older `jj` binaries. The new model
solves some performance problems with the old model. For example, `jj log`
should be noticeably faster on large repos. You may need to create a new
clone to see the full speedup.

### New features

### Fixed bugs
Expand Down
3 changes: 3 additions & 0 deletions cli/src/config/misc.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[aliases]
# Placeholder: added by user

[format]
tree-level-conflicts = true

[ui]
paginate = "auto"
pager = { command = ["less", "-FRX"], env = { LESSCHARSET = "utf-8" } }
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_chmod_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn test_chmod_file_dir_deletion_conflicts() {
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["chmod", "x", "file", "-r=file_deletion"]);
insta::assert_snapshot!(stdout, @r###"
Working copy now at: kmkuslsw 85942d95 file_deletion | (conflict) file_deletion
Working copy now at: kmkuslsw 8b70a1d2 file_deletion | (conflict) file_deletion
Parent commit : zsuskuln c51c9c55 file | file
Parent commit : royxmykx 6b18b3c1 deletion | deletion
Added 0 files, modified 1 files, removed 0 files
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/test_diffedit_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ fn test_diffedit_merge() {
.unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diffedit", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r###"
Created royxmykx a70eded7 (conflict) merge
Created royxmykx 2b5202ae (conflict) merge
Rebased 1 descendant commits
Working copy now at: yqosqzyt a5f1ce84 (conflict) (empty) (no description set)
Parent commit : royxmykx a70eded7 (conflict) merge
Working copy now at: yqosqzyt 23b1fe1b (conflict) (empty) (no description set)
Parent commit : royxmykx 2b5202ae (conflict) merge
Added 0 files, modified 0 files, removed 1 files
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]);
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_git_push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ fn test_git_push_conflict() {
test_env.jj_cmd_success(&workspace_root, &["describe", "-m", "third"]);
let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--all"]);
insta::assert_snapshot!(stderr, @r###"
Error: Won't push commit 3a1497bff04c since it has conflicts
Error: Won't push commit 1973d389875c since it has conflicts
"###);
}

Expand Down
32 changes: 16 additions & 16 deletions cli/tests/test_immutable_commits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn test_rewrite_immutable_commands() {
insta::assert_snapshot!(stdout, @r###"
@ yqosqzyt [email protected] 2001-02-03 04:05:13.000 +07:00 3f89addf
│ (empty) (no description set)
│ ◉ mzvwutvl [email protected] 2001-02-03 04:05:11.000 +07:00 main d809c5d9 conflict
│ ◉ mzvwutvl [email protected] 2001-02-03 04:05:11.000 +07:00 main 16ca9d80 conflict
╭─┤ (empty) merge
│ │
│ ~
Expand All @@ -115,49 +115,49 @@ fn test_rewrite_immutable_commands() {
// abandon
let stderr = test_env.jj_cmd_failure(&repo_path, &["abandon", "main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// chmod
let stderr = test_env.jj_cmd_failure(&repo_path, &["chmod", "-r=main", "x", "file"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// describe
let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// diffedit
let stderr = test_env.jj_cmd_failure(&repo_path, &["diffedit", "-r=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// edit
let stderr = test_env.jj_cmd_failure(&repo_path, &["edit", "main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// move --from
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--from=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// move --to
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--to=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// rebase -s
let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-s=main", "-d=@"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// rebase -b
Expand All @@ -169,43 +169,43 @@ fn test_rewrite_immutable_commands() {
// rebase -r
let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-r=main", "-d=@"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// resolve
let stderr = test_env.jj_cmd_failure(&repo_path, &["resolve", "-r=description(merge)", "file"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// restore -c
let stderr = test_env.jj_cmd_failure(&repo_path, &["restore", "-c=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// restore --to
let stderr = test_env.jj_cmd_failure(&repo_path, &["restore", "--to=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// split
let stderr = test_env.jj_cmd_failure(&repo_path, &["split", "-r=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// squash
let stderr = test_env.jj_cmd_failure(&repo_path, &["squash", "-r=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
// unsquash
let stderr = test_env.jj_cmd_failure(&repo_path, &["unsquash", "-r=main"]);
insta::assert_snapshot!(stderr, @r###"
Error: Commit d809c5d93710 is immutable
Error: Commit 16ca9d800b08 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
"###);
}
28 changes: 15 additions & 13 deletions cli/tests/test_obslog_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn test_obslog_with_or_without_diff() {
insta::assert_snapshot!(stdout, @r###"
@ rlvkpnrz [email protected] 2001-02-03 04:05:10.000 +07:00 66b42ad3
│ my description
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 af536e5a conflict
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict
│ my description
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc
│ my description
Expand All @@ -46,7 +46,7 @@ fn test_obslog_with_or_without_diff() {
insta::assert_snapshot!(stdout, @r###"
@ rlvkpnrz [38;5;[email protected] 2001-02-03 04:05:10.000 +07:00 66b42ad3
│ my description
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 04:05:09.000 +07:00[39m [1m[38;5;4maf[0m[38;5;8m536e5a[39m [38;5;1mconflict[39m
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 04:05:09.000 +07:00[39m [1m[38;5;4m5[0m[38;5;8mf4634a5[39m [38;5;1mconflict[39m
│ my description
◉ rlvkpnrz hidden [38;5;[email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc
│ my description
Expand All @@ -63,11 +63,12 @@ fn test_obslog_with_or_without_diff() {
│ Resolved conflict in file1:
│ 1 1: <<<<<<<resolved
│ 2 : %%%%%%%
│ 3 : foo
│ 4 : +bar
│ 5 : +++++++
│ 6 : >>>>>>>
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 af536e5a conflict
│ 3 : -foo
│ 4 : +++++++
│ 5 : foo
│ 6 : bar
│ 7 : >>>>>>>
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict
│ my description
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc
│ my description
Expand All @@ -85,7 +86,7 @@ fn test_obslog_with_or_without_diff() {
insta::assert_snapshot!(stdout, @r###"
@ rlvkpnrz [email protected] 2001-02-03 04:05:10.000 +07:00 66b42ad3
│ my description
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 af536e5a conflict
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict
│ my description
"###);

Expand All @@ -94,7 +95,7 @@ fn test_obslog_with_or_without_diff() {
insta::assert_snapshot!(stdout, @r###"
rlvkpnrz [email protected] 2001-02-03 04:05:10.000 +07:00 66b42ad3
my description
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 af536e5a conflict
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict
my description
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc
my description
Expand All @@ -111,15 +112,16 @@ fn test_obslog_with_or_without_diff() {
index 0000000000...2ab19ae607 100644
--- a/file1
+++ b/file1
@@ -1,6 +1,1 @@
@@ -1,7 +1,1 @@
-<<<<<<<
-%%%%%%%
- foo
-+bar
--foo
-+++++++
-foo
-bar
->>>>>>>
+resolved
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 af536e5a conflict
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict
my description
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc
my description
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/test_resolve_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ conflict
],
),
@r###"
Working copy now at: vruxwmqv 0bb40c90 conflict | (conflict) conflict
Working copy now at: vruxwmqv ff4e8c6b conflict | (conflict) conflict
Parent commit : zsuskuln aa493daf a | a
Parent commit : royxmykx db6a4daf b | b
Added 0 files, modified 1 files, removed 0 files
Expand Down Expand Up @@ -632,7 +632,7 @@ fn test_multiple_conflicts() {
std::fs::write(&editor_script, "expect\n\0write\nresolution another_file\n").unwrap();
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "another_file"]), @r###"
Working copy now at: vruxwmqv 07feb084 conflict | (conflict) conflict
Working copy now at: vruxwmqv c3c25bce conflict | (conflict) conflict
Parent commit : zsuskuln de7553ef a | a
Parent commit : royxmykx f68bc2f0 b | b
Added 0 files, modified 1 files, removed 0 files
Expand Down Expand Up @@ -660,7 +660,7 @@ fn test_multiple_conflicts() {
std::fs::write(&editor_script, "expect\n\0write\nresolution another_file\n").unwrap();
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--quiet", "another_file"]), @r###"
Working copy now at: vruxwmqv ff142405 conflict | (conflict) conflict
Working copy now at: vruxwmqv fd3874cd conflict | (conflict) conflict
Parent commit : zsuskuln de7553ef a | a
Parent commit : royxmykx f68bc2f0 b | b
Added 0 files, modified 1 files, removed 0 files
Expand Down
10 changes: 5 additions & 5 deletions cli/tests/test_restore_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn test_restore() {
insta::assert_snapshot!(stdout, @r###"
Created rlvkpnrz e25100af (empty) (no description set)
Rebased 1 descendant commits
Working copy now at: kkmpptxz fd42591e (conflict) (no description set)
Working copy now at: kkmpptxz e301deb3 (conflict) (no description set)
Parent commit : rlvkpnrz e25100af (empty) (no description set)
Added 0 files, modified 1 files, removed 0 files
"###);
Expand Down Expand Up @@ -184,8 +184,8 @@ fn test_restore_conflicted_merge() {
// ...and restore it back again.
let stdout = test_env.jj_cmd_success(&repo_path, &["restore", "file"]);
insta::assert_snapshot!(stdout, @r###"
Created vruxwmqv 63198ca2 (conflict) (empty) conflict
Working copy now at: vruxwmqv 63198ca2 conflict | (conflict) (empty) conflict
Created vruxwmqv b2c9c888 (conflict) (empty) conflict
Working copy now at: vruxwmqv b2c9c888 conflict | (conflict) (empty) conflict
Parent commit : zsuskuln aa493daf a | a
Parent commit : royxmykx db6a4daf b | b
Added 0 files, modified 1 files, removed 0 files
Expand Down Expand Up @@ -222,8 +222,8 @@ fn test_restore_conflicted_merge() {
// ... and restore it back again.
let stdout = test_env.jj_cmd_success(&repo_path, &["restore"]);
insta::assert_snapshot!(stdout, @r###"
Created vruxwmqv d955febc (conflict) (empty) conflict
Working copy now at: vruxwmqv d955febc conflict | (conflict) (empty) conflict
Created vruxwmqv 4fc10820 (conflict) (empty) conflict
Working copy now at: vruxwmqv 4fc10820 conflict | (conflict) (empty) conflict
Parent commit : zsuskuln aa493daf a | a
Parent commit : royxmykx db6a4daf b | b
Added 0 files, modified 1 files, removed 0 files
Expand Down
1 change: 1 addition & 0 deletions cli/tests/test_tree_level_conflicts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub mod common;
#[test]
fn test_enable_tree_level_conflicts() {
let test_env = TestEnvironment::default();
test_env.add_config(r#"format.tree-level-conflicts = false"#);
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
let repo_path = test_env.env_root().join("repo");

Expand Down
4 changes: 2 additions & 2 deletions cli/tests/test_workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn test_workspaces_conflicting_edits() {
"###);
insta::assert_snapshot!(get_log_output(&test_env, &secondary_path),
@r###"
8d90dc175c874af0dff032d611029dc722d4e108 (divergent)
a3c96849ef9f124cbfc2416dc13bf17309d5020a (divergent)
│ ◉ fe8f41ed01d693b2d4365cd89e42ad9c531a939b default@
├─╯
│ @ a1896a17282f19089a5cec44358d6609910e0513 secondary@ (divergent)
Expand All @@ -149,7 +149,7 @@ fn test_workspaces_conflicting_edits() {
let stdout = get_log_output(&test_env, &secondary_path);
assert!(!stdout.starts_with("The working copy is stale"));
insta::assert_snapshot!(stdout, @r###"
8d90dc175c874af0dff032d611029dc722d4e108 (divergent)
a3c96849ef9f124cbfc2416dc13bf17309d5020a (divergent)
│ ◉ fe8f41ed01d693b2d4365cd89e42ad9c531a939b default@
├─╯
│ @ a1896a17282f19089a5cec44358d6609910e0513 secondary@ (divergent)
Expand Down

0 comments on commit 0027159

Please sign in to comment.