From 2ccb17b7b390e55a591bd0b683db446d18b3efc6 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 4 Oct 2023 21:30:29 -0700 Subject: [PATCH] cli: enable tree-level conflicts by default I have used the tree-level conflict format for several weeks without problem (after the fix in 51b5d168aed0). 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`). --- CHANGELOG.md | 6 +++++ cli/src/config/misc.toml | 3 +++ cli/tests/test_chmod_command.rs | 2 +- cli/tests/test_diffedit_command.rs | 6 ++--- cli/tests/test_git_push.rs | 2 +- cli/tests/test_immutable_commits.rs | 32 +++++++++++++------------- cli/tests/test_obslog_command.rs | 28 +++++++++++----------- cli/tests/test_resolve_command.rs | 6 ++--- cli/tests/test_restore_command.rs | 10 ++++---- cli/tests/test_tree_level_conflicts.rs | 1 + cli/tests/test_workspaces.rs | 4 ++-- 11 files changed, 56 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2f44dce2..bb996ef2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/cli/src/config/misc.toml b/cli/src/config/misc.toml index ab831753a..d4684ee20 100644 --- a/cli/src/config/misc.toml +++ b/cli/src/config/misc.toml @@ -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" } } diff --git a/cli/tests/test_chmod_command.rs b/cli/tests/test_chmod_command.rs index 2c752e50e..5c5500bd7 100644 --- a/cli/tests/test_chmod_command.rs +++ b/cli/tests/test_chmod_command.rs @@ -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 diff --git a/cli/tests/test_diffedit_command.rs b/cli/tests/test_diffedit_command.rs index c5f9554dd..e6bfad5a0 100644 --- a/cli/tests/test_diffedit_command.rs +++ b/cli/tests/test_diffedit_command.rs @@ -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", "@-"]); diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index ae48acb63..db9ec30e9 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -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 "###); } diff --git a/cli/tests/test_immutable_commits.rs b/cli/tests/test_immutable_commits.rs index c9bc06957..66e42053b 100644 --- a/cli/tests/test_immutable_commits.rs +++ b/cli/tests/test_immutable_commits.rs @@ -102,7 +102,7 @@ fn test_rewrite_immutable_commands() { insta::assert_snapshot!(stdout, @r###" @ yqosqzyt test.user@example.com 2001-02-03 04:05:13.000 +07:00 3f89addf │ (empty) (no description set) - │ ◉ mzvwutvl test.user@example.com 2001-02-03 04:05:11.000 +07:00 main d809c5d9 conflict + │ ◉ mzvwutvl test.user@example.com 2001-02-03 04:05:11.000 +07:00 main 16ca9d80 conflict ╭─┤ (empty) merge │ │ │ ~ @@ -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 @@ -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()`. "###); } diff --git a/cli/tests/test_obslog_command.rs b/cli/tests/test_obslog_command.rs index 17d03d984..ea935ac9d 100644 --- a/cli/tests/test_obslog_command.rs +++ b/cli/tests/test_obslog_command.rs @@ -33,7 +33,7 @@ fn test_obslog_with_or_without_diff() { insta::assert_snapshot!(stdout, @r###" @ rlvkpnrz test.user@example.com 2001-02-03 04:05:10.000 +07:00 66b42ad3 │ my description - ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5a conflict + ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict │ my description ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bc │ my description @@ -46,7 +46,7 @@ fn test_obslog_with_or_without_diff() { insta::assert_snapshot!(stdout, @r###" @ rlvkpnrz test.user@example.com 2001-02-03 04:05:10.000 +07:00 66b42ad3 │ my description - ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5a conflict + ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict │ my description ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bc │ my description @@ -63,11 +63,12 @@ fn test_obslog_with_or_without_diff() { │ Resolved conflict in file1: │ 1 1: <<<<<<>>>>>> - ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5a conflict + │ 3 : -foo + │ 4 : +++++++ + │ 5 : foo + │ 6 : bar + │ 7 : >>>>>>> + ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict │ my description ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bc │ my description @@ -85,7 +86,7 @@ fn test_obslog_with_or_without_diff() { insta::assert_snapshot!(stdout, @r###" @ rlvkpnrz test.user@example.com 2001-02-03 04:05:10.000 +07:00 66b42ad3 │ my description - ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5a conflict + ◉ rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict │ my description "###); @@ -94,7 +95,7 @@ fn test_obslog_with_or_without_diff() { insta::assert_snapshot!(stdout, @r###" rlvkpnrz test.user@example.com 2001-02-03 04:05:10.000 +07:00 66b42ad3 my description - rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5a conflict + rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict my description rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bc my description @@ -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 test.user@example.com 2001-02-03 04:05:09.000 +07:00 af536e5a conflict + rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict my description rlvkpnrz hidden test.user@example.com 2001-02-03 04:05:09.000 +07:00 6fbba7bc my description diff --git a/cli/tests/test_resolve_command.rs b/cli/tests/test_resolve_command.rs index 35468419d..7e0ea60b8 100644 --- a/cli/tests/test_resolve_command.rs +++ b/cli/tests/test_resolve_command.rs @@ -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 @@ -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 @@ -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 diff --git a/cli/tests/test_restore_command.rs b/cli/tests/test_restore_command.rs index 6ffc42441..8d821453e 100644 --- a/cli/tests/test_restore_command.rs +++ b/cli/tests/test_restore_command.rs @@ -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 "###); @@ -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 @@ -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 diff --git a/cli/tests/test_tree_level_conflicts.rs b/cli/tests/test_tree_level_conflicts.rs index 047a95951..c2d5f95c5 100644 --- a/cli/tests/test_tree_level_conflicts.rs +++ b/cli/tests/test_tree_level_conflicts.rs @@ -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"); diff --git a/cli/tests/test_workspaces.rs b/cli/tests/test_workspaces.rs index 921ddc57a..5bae26c3d 100644 --- a/cli/tests/test_workspaces.rs +++ b/cli/tests/test_workspaces.rs @@ -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) @@ -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)