From 4a17b9fbe4651b3704d43a3f368de2b8895a06a2 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Wed, 14 Aug 2024 19:24:29 +0800 Subject: [PATCH] rebase: modify tests to avoid printing commit and change IDs I think they were adding too much noise to commit diffs. Only the tests focused on skipping rebasing will include the commit and change IDs, other tests will omit them. --- cli/tests/test_rebase_command.rs | 670 +++++++++++++++---------------- 1 file changed, 335 insertions(+), 335 deletions(-) diff --git a/cli/tests/test_rebase_command.rs b/cli/tests/test_rebase_command.rs index fbb4570b5..db76687c7 100644 --- a/cli/tests/test_rebase_command.rs +++ b/cli/tests/test_rebase_command.rs @@ -948,10 +948,6 @@ fn test_rebase_error_revision_does_not_exist() { "###); } -fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String { - test_env.jj_cmd_success(repo_path, &["log", "-T", "branches"]) -} - // This behavior illustrates https://github.com/martinvonz/jj/issues/2600 #[test] fn test_rebase_with_child_and_descendant_bug_2600() { @@ -1311,20 +1307,20 @@ fn test_rebase_revisions_after() { create_commit(&test_env, &repo_path, "e", &["c"]); create_commit(&test_env, &repo_path, "f", &["e"]); // Test the setup - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn e4a00798 - ○ e nkmrtpmo 858693f7 - │ ○ d lylxulpl 7d0512e5 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); let setup_opid = test_env.current_operation_id(&repo_path); @@ -1338,20 +1334,20 @@ fn test_rebase_revisions_after() { Skipped rebase of 4 commits that were already in place Nothing changed. "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn e4a00798 - ○ e nkmrtpmo 858693f7 - │ ○ d lylxulpl 7d0512e5 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); // Rebasing a commit after itself should be a no-op. @@ -1361,20 +1357,20 @@ fn test_rebase_revisions_after() { Skipped rebase of 4 commits that were already in place Nothing changed. "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn e4a00798 - ○ e nkmrtpmo 858693f7 - │ ○ d lylxulpl 7d0512e5 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); // Rebase a commit after another commit. "c" has parents "b2" and "b4", so its @@ -1387,20 +1383,20 @@ fn test_rebase_revisions_after() { Working copy now at: xznxytkn e0e873c8 f | f Parent commit : kmkuslsw 754793f3 c | c "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn e0e873c8 - ○ c kmkuslsw 754793f3 - ○ e nkmrtpmo e0d7fb63 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ c + ○ e ├─╮ - │ │ ○ d lylxulpl 5e9cb58d + │ │ ○ d ╭─┬─╯ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1414,20 +1410,20 @@ fn test_rebase_revisions_after() { Parent commit : kmkuslsw cd86b3e4 c | c Added 0 files, modified 0 files, removed 1 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo 76ac6464 - @ f xznxytkn 9804b742 - │ ○ d lylxulpl 7d0512e5 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + @ f + │ ○ d ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1441,20 +1437,20 @@ fn test_rebase_revisions_after() { Parent commit : zsuskuln 072d5ae1 b1 | b1 Added 0 files, modified 0 files, removed 5 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo cee7a197 - │ ○ d lylxulpl 1eb960ec + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw 305a7803 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 526481b4 - @ │ f xznxytkn 80c27408 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + @ │ f + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1468,20 +1464,20 @@ fn test_rebase_revisions_after() { Parent commit : royxmykx 2b8e1148 b2 | b2 Added 0 files, modified 0 files, removed 4 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo 3162ac52 - │ ○ d lylxulpl 6f7f3b2a + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw d33f69f1 + ○ c ├─╮ - │ @ f xznxytkn ebbc24b1 - │ ○ b2 royxmykx 2b8e1148 - │ ○ b1 zsuskuln 072d5ae1 - ○ │ b4 znkkpsqq a52a83a4 - ○ │ b3 vruxwmqv 523e6a8b + │ @ f + │ ○ b2 + │ ○ b1 + ○ │ b4 + ○ │ b3 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1497,20 +1493,20 @@ fn test_rebase_revisions_after() { Parent commit : kmkuslsw cd86b3e4 c | c Added 0 files, modified 0 files, removed 1 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo 03ade273 - │ ○ d lylxulpl 8bccbeda + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + │ ○ d ├─╯ - @ f xznxytkn 8f8c91d3 - ○ c kmkuslsw cd86b3e4 + @ f + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1527,21 +1523,21 @@ fn test_rebase_revisions_after() { Parent commit : lylxulpl 7d0512e5 d | d Added 1 files, modified 0 files, removed 0 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn 7784e5a0 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f ├─╮ - │ ○ d lylxulpl 7d0512e5 - ○ │ e nkmrtpmo 858693f7 + │ ○ d + ○ │ e ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1558,21 +1554,21 @@ fn test_rebase_revisions_after() { Parent commit : kmkuslsw 193687bb c | c Added 1 files, modified 0 files, removed 0 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn 0b53613e - ○ c kmkuslsw 193687bb + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ c ├─╮ - │ ○ b4 znkkpsqq e8d0f57b - │ ○ b3 vruxwmqv cb48344c + │ ○ b4 + │ ○ b3 │ ├─╮ - ○ │ │ b2 royxmykx 535f779d - ○ │ │ b1 zsuskuln 693186c0 + ○ │ │ b2 + ○ │ │ b1 ╰─┬─╮ - │ ○ e nkmrtpmo 2bb4e0b6 - ○ │ d lylxulpl 0b921a1c + │ ○ e + ○ │ d ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1590,22 +1586,22 @@ fn test_rebase_revisions_after() { Parent commit : nkmrtpmo 0d7e4ce9 e | e Added 0 files, modified 0 files, removed 3 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ d lylxulpl 16060da9 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ d ├─╮ - │ │ ○ c kmkuslsw ef5ead27 + │ │ ○ c │ │ ├─╮ - │ │ │ ○ b4 znkkpsqq 9c884b94 - │ │ ○ │ b2 royxmykx bdfea21d + │ │ │ ○ b4 + │ │ ○ │ b2 │ │ ├─╯ - │ │ @ f xznxytkn eaf1d6b8 - │ │ ○ e nkmrtpmo 0d7e4ce9 + │ │ @ f + │ │ ○ e ╭─┬─╯ - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b3 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1620,19 +1616,19 @@ fn test_rebase_revisions_after() { Parent commit : nkmrtpmo 563d78c6 e | e Added 1 files, modified 0 files, removed 0 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn 084e0629 - ○ e nkmrtpmo 563d78c6 - ○ d lylxulpl e67ba5c9 - ○ c kmkuslsw 049aa109 - ○ b2 royxmykx 7af3d6cd - ○ b1 zsuskuln cd84b343 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + ○ d + ○ c + ○ b2 + ○ b1 ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b + │ ○ b4 + │ ○ b3 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1650,20 +1646,20 @@ fn test_rebase_revisions_after() { Parent commit : kmkuslsw cebde86a c | c Added 0 files, modified 0 files, removed 2 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn 4fb2bb60 - │ ○ e nkmrtpmo 1ea93588 - │ ○ b2 royxmykx 064e3bcb - │ ○ d lylxulpl b46a9d31 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + │ ○ e + │ ○ b2 + │ ○ d ├─╯ - ○ c kmkuslsw cebde86a + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1693,20 +1689,20 @@ fn test_rebase_revisions_before() { create_commit(&test_env, &repo_path, "e", &["c"]); create_commit(&test_env, &repo_path, "f", &["e"]); // Test the setup - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn e4a00798 - ○ e nkmrtpmo 858693f7 - │ ○ d lylxulpl 7d0512e5 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); let setup_opid = test_env.current_operation_id(&repo_path); @@ -1720,20 +1716,20 @@ fn test_rebase_revisions_before() { Skipped rebase of 4 commits that were already in place Nothing changed. "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn e4a00798 - ○ e nkmrtpmo 858693f7 - │ ○ d lylxulpl 7d0512e5 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); // Rebasing a commit before itself should be a no-op. @@ -1743,20 +1739,20 @@ fn test_rebase_revisions_before() { Skipped rebase of 4 commits that were already in place Nothing changed. "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn e4a00798 - ○ e nkmrtpmo 858693f7 - │ ○ d lylxulpl 7d0512e5 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); // Rebasing a commit before the root commit should error. @@ -1775,20 +1771,20 @@ fn test_rebase_revisions_before() { Working copy now at: xznxytkn 24335685 f | f Parent commit : nkmrtpmo e9a28d4b e | e "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn 24335685 - ○ e nkmrtpmo e9a28d4b + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e ├─╮ - │ │ ○ d lylxulpl 6609e9c6 + │ │ ○ d ╭─┬─╯ - │ ○ b4 znkkpsqq 4b39b18c - │ ○ b3 vruxwmqv 39f79dcc - ○ │ b2 royxmykx ffcf6038 - ○ │ b1 zsuskuln 85e90af6 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 318ea816 - ○ c kmkuslsw 5f99791e - ◆ zzzzzzzz 00000000 + ○ a + ○ c + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1802,20 +1798,20 @@ fn test_rebase_revisions_before() { Parent commit : kmkuslsw cd86b3e4 c | c Added 0 files, modified 0 files, removed 1 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo 41706bd9 - @ f xznxytkn 8e3b728a - │ ○ d lylxulpl 7d0512e5 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + @ f + │ ○ d ├─╯ - ○ c kmkuslsw cd86b3e4 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1829,20 +1825,20 @@ fn test_rebase_revisions_before() { Parent commit : zsuskuln 072d5ae1 b1 | b1 Added 0 files, modified 0 files, removed 5 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo 7cad61fd - │ ○ d lylxulpl 526b6ab6 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw 445f6927 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 972bfeb7 - @ │ f xznxytkn 2b4f48f8 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + @ │ f + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1856,20 +1852,20 @@ fn test_rebase_revisions_before() { Parent commit : rlvkpnrz 2443ea76 a | a Added 0 files, modified 0 files, removed 6 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo 9d5fa6a2 - │ ○ d lylxulpl ca323694 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw 07426e1a + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 55376058 - ○ │ b1 zsuskuln cd5b1d04 - @ │ f xznxytkn 488ebb95 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 + @ │ f ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1886,20 +1882,20 @@ fn test_rebase_revisions_before() { Parent commit : znkkpsqq a52a83a4 b4 | b4 Added 0 files, modified 0 files, removed 2 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo 0ea67093 - │ ○ d lylxulpl c079568d + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw 6371742b - @ f xznxytkn aae1bc10 + ○ c + @ f ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx 2b8e1148 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b4 + │ ○ b3 + ○ │ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1915,20 +1911,20 @@ fn test_rebase_revisions_before() { Working copy now at: xznxytkn 8268ec4d f | f Parent commit : nkmrtpmo fd26fbd4 e | e "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn 8268ec4d - ○ e nkmrtpmo fd26fbd4 - │ ○ d lylxulpl 21da64b4 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ b1 zsuskuln 83e9b8ac - ○ c kmkuslsw a89354fc + ○ b1 + ○ c ├─╮ - │ ○ b4 znkkpsqq a52a83a4 - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b2 royxmykx b7f03180 + │ ○ b4 + │ ○ b3 + ○ │ b2 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1947,22 +1943,22 @@ fn test_rebase_revisions_before() { Parent commit : vruxwmqv 523e6a8b b3 | b3 Added 0 files, modified 0 files, removed 4 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - ○ e nkmrtpmo 9436134a - │ ○ d lylxulpl 534be1ee + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw bc3ed9f8 + ○ c ├─╮ - │ ○ b4 znkkpsqq 3e59611b - ○ │ b2 royxmykx 148d7e50 + │ ○ b4 + ○ │ b2 ├─╯ - @ f xznxytkn 7ba8014f + @ f ├─╮ - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b3 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -1979,22 +1975,22 @@ fn test_rebase_revisions_before() { Working copy now at: xznxytkn fabd8dd7 f | f Parent commit : nkmrtpmo b5933877 e | e "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn fabd8dd7 - ○ e nkmrtpmo b5933877 - │ ○ d lylxulpl 6b91dd66 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ c kmkuslsw d873acf7 + ○ c ├─╮ - │ ○ b3 vruxwmqv 1fd332d8 - ○ │ b1 zsuskuln 8e39430f + │ ○ b3 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 414580f5 + ○ a ├─╮ - │ ○ b4 znkkpsqq ae3d5bdb - ○ │ b2 royxmykx a225236e + │ ○ b4 + ○ │ b2 ├─╯ - ◆ zzzzzzzz 00000000 + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -2010,22 +2006,22 @@ fn test_rebase_revisions_before() { Working copy now at: xznxytkn cbe2be58 f | f Parent commit : nkmrtpmo e31053d1 e | e "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn cbe2be58 - ○ e nkmrtpmo e31053d1 - ○ c kmkuslsw 23155860 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + ○ c ├─╮ - │ ○ b4 znkkpsqq e50520ad + │ ○ b4 │ ├─╮ - ○ │ │ b2 royxmykx 54f03b06 + ○ │ │ b2 ╰─┬─╮ - ○ │ │ d lylxulpl 0c74206e + ○ │ │ d ╰─┬─╮ - │ ○ b3 vruxwmqv 523e6a8b - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b3 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -2042,20 +2038,20 @@ fn test_rebase_revisions_before() { Working copy now at: xznxytkn 1c48b514 f | f Parent commit : kmkuslsw c0fd979a c | c "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f xznxytkn 1c48b514 - │ ○ d lylxulpl 4dbbc808 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + │ ○ d ├─╯ - ○ c kmkuslsw c0fd979a + ○ c ├─╮ - │ ○ b4 znkkpsqq 4d5c61f4 - │ ○ b3 vruxwmqv d5699c24 - ○ │ b2 royxmykx e23ab998 + │ ○ b4 + │ ○ b3 + ○ │ b2 ├─╯ - ○ a rlvkpnrz 076f0094 - ○ e nkmrtpmo 20d1f131 - ○ b1 zsuskuln 11db739a - ◆ zzzzzzzz 00000000 + ○ a + ○ e + ○ b1 + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -2083,18 +2079,18 @@ fn test_rebase_revisions_after_before() { create_commit(&test_env, &repo_path, "e", &["c"]); create_commit(&test_env, &repo_path, "f", &["e"]); // Test the setup - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f lylxulpl 88f778c5 - ○ e kmkuslsw 48dd9e3f - │ ○ d znkkpsqq 92438fc9 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e + │ ○ d ├─╯ - ○ c vruxwmqv c41e416e + ○ c ├─╮ - │ ○ b2 royxmykx 903ab0d6 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); let setup_opid = test_env.current_operation_id(&repo_path); @@ -2112,17 +2108,17 @@ fn test_rebase_revisions_after_before() { Parent commit : znkkpsqq cca70ee1 d | d Added 1 files, modified 0 files, removed 0 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f lylxulpl fe3d8c30 - ○ d znkkpsqq cca70ee1 - ○ e kmkuslsw 48dd9e3f - ○ c vruxwmqv c41e416e + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ d + ○ e + ○ c ├─╮ - │ ○ b2 royxmykx 903ab0d6 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -2141,19 +2137,19 @@ fn test_rebase_revisions_after_before() { Parent commit : znkkpsqq 61388bb6 d | d Added 1 files, modified 0 files, removed 0 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f lylxulpl 22f0323c + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f ├─╮ - │ ○ d znkkpsqq 61388bb6 - ○ │ e kmkuslsw 48dd9e3f - ○ │ c vruxwmqv c41e416e + │ ○ d + ○ │ e + ○ │ c ├───╮ - │ │ ○ b2 royxmykx 903ab0d6 + │ │ ○ b2 │ ├─╯ - ○ │ b1 zsuskuln 072d5ae1 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -2173,18 +2169,18 @@ fn test_rebase_revisions_after_before() { Parent commit : kmkuslsw 9bbc9e53 e | e Added 1 files, modified 0 files, removed 0 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f lylxulpl e37682c5 - ○ e kmkuslsw 9bbc9e53 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f + ○ e ├─┬─╮ - │ │ ○ c vruxwmqv e11c7c95 - │ │ ○ d znkkpsqq 37869bd5 + │ │ ○ c + │ │ ○ d ╭─┬─╯ - │ ○ b2 royxmykx 903ab0d6 - ○ │ b1 zsuskuln 072d5ae1 + │ ○ b2 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -2209,19 +2205,19 @@ fn test_rebase_revisions_after_before() { Parent commit : kmkuslsw a55a6779 e | e Added 1 files, modified 0 files, removed 0 files "###); - insta::assert_snapshot!(get_long_log_output(&test_env, &repo_path), @r###" - @ f lylxulpl 868f6c61 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + @ f ├─┬─┬─╮ - │ │ │ ○ e kmkuslsw a55a6779 - │ │ ○ │ d znkkpsqq ae6181e6 + │ │ │ ○ e + │ │ ○ │ d │ │ ├─╯ - │ │ ○ c vruxwmqv 22540859 - │ ○ │ b2 royxmykx 903ab0d6 + │ │ ○ c + │ ○ │ b2 │ ├─╯ - ○ │ b1 zsuskuln 072d5ae1 + ○ │ b1 ├─╯ - ○ a rlvkpnrz 2443ea76 - ◆ zzzzzzzz 00000000 + ○ a + ◆ "###); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -2394,6 +2390,10 @@ fn test_rebase_skip_if_on_destination() { "###); } +fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String { + test_env.jj_cmd_success(repo_path, &["log", "-T", "branches"]) +} + fn get_long_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String { let template = r#"description.first_line() ++ " " ++ change_id.shortest(8) ++ " " ++ commit_id.shortest(8)"#; test_env.jj_cmd_success(repo_path, &["log", "-T", template])