// Copyright 2024 The Jujutsu Authors//// Licensed under the Apache License, Version 2.0 (the "License");// you may not use this file except in compliance with the License.// You may obtain a copy of the License at//// https://www.apache.org/licenses/LICENSE-2.0//// Unless required by applicable law or agreed to in writing, software// distributed under the License is distributed on an "AS IS" BASIS,// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.// See the License for the specific language governing permissions and// limitations under the License. use std::path::Path; use crate::common::CommandOutput;use crate::common::TestEnvironment; #[test]fn test_parallelize_no_descendants() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..6 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["describe", "-m=6"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 02b7709cc4e9 6 parents: 5 ○ 1b2f08d76b66 5 parents: 4 ○ e5c4cf44e237 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in(&workspace_path, ["parallelize", "description(1)::"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 4850b4629edb 6 parents: │ ○ 87627fbb7d29 5 parents: ├─╯ │ ○ 5b9815e28fae 4 parents: ├─╯ │ ○ bb1bb465ccc2 3 parents: ├─╯ │ ○ 337eca1ef3a8 2 parents: ├─╯ │ ○ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] ");} // Only the head commit has descendants.#[test]fn test_parallelize_with_descendants_simple() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..6 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["describe", "-m=6"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 02b7709cc4e9 6 parents: 5 ○ 1b2f08d76b66 5 parents: 4 ○ e5c4cf44e237 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(4)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 9bc057f8b6e3 6 parents: 5 ○ 9e36a8afe793 5 parents: 1 2 3 4 ├─┬─┬─╮ │ │ │ ○ 5b9815e28fae 4 parents: │ │ ○ │ bb1bb465ccc2 3 parents: │ │ ├─╯ │ ○ │ 337eca1ef3a8 2 parents: │ ├─╯ ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] ");} // One of the commits being parallelized has a child that isn't being// parallelized. That child will become a merge of any ancestors which are being// parallelized.#[test]fn test_parallelize_where_interior_has_non_target_children() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..6 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["new", "description(2)", "-m=2c"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "description(5)", "-m=6"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 2508ea92308a 6 parents: 5 ○ 1b2f08d76b66 5 parents: 4 ○ e5c4cf44e237 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 │ ○ 3e7571e62c87 2c parents: 2 ├─╯ ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(4)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ c9525dff9d03 6 parents: 5 ○ b3ad09518546 5 parents: 1 2 3 4 ├─┬─┬─╮ │ │ │ ○ 3b125ed6a683 4 parents: │ │ ○ │ 1ed8c0c5be30 3 parents: │ │ ├─╯ │ │ │ ○ c01d8e85ea96 2c parents: 1 2 ╭─┬───╯ │ ○ │ 7efea6c89b60 2 parents: │ ├─╯ ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] ");} #[test]fn test_parallelize_where_root_has_non_target_children() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..4 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["new", "description(1)", "-m=1c"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "description(3)", "-m=4"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 9132691e6256 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 │ ○ 6c64110df0a5 1c parents: 1 ├─╯ ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(3)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 3397916989e7 4 parents: 1 2 3 ├─┬─╮ │ │ ○ 1f768c1bc591 3 parents: │ ○ │ 12ef12b4640e 2 parents: │ ├─╯ │ │ ○ 6c64110df0a5 1c parents: 1 ├───╯ ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] ");} // One of the commits being parallelized has a child that is a merge commit.#[test]fn test_parallelize_with_merge_commit_child() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["commit", "-m", "1"]) .success(); for n in 2..4 { test_env .run_jj_in(&workspace_path, ["commit", "-m", &n.to_string()]) .success(); } test_env .run_jj_in(&workspace_path, ["new", "root()", "-m", "a"]) .success(); test_env .run_jj_in( &workspace_path, ["new", "description(2)", "description(a)", "-m", "2a-c"], ) .success(); test_env .run_jj_in(&workspace_path, ["new", "description(3)", "-m", "4"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 99ffaf5b3984 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 │ ○ 4313cc3b476f 2a-c parents: 2 a ╭─┤ │ ○ 1eb902150bb9 a parents: ○ │ d3902619fade 2 parents: 1 ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); // After this finishes, child-2a will have three parents: "1", "2", and "a". test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(3)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 3ee9279847a6 4 parents: 1 2 3 ├─┬─╮ │ │ ○ bb1bb465ccc2 3 parents: │ │ │ ○ c70ee196514b 2a-c parents: 1 2 a ╭─┬───┤ │ │ │ ○ 1eb902150bb9 a parents: │ │ ├─╯ │ ○ │ 337eca1ef3a8 2 parents: │ ├─╯ ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] ");} #[test]fn test_parallelize_disconnected_target_commits() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..3 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["describe", "-m=3"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); let output = test_env.run_jj_in( &workspace_path, ["parallelize", "description(1)", "description(3)"], ); insta::assert_snapshot!(output, @r" ------- stderr ------- Nothing changed. [EOF] "); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] ");} #[test]fn test_parallelize_head_is_a_merge() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["commit", "-m=0"]) .success(); test_env .run_jj_in(&workspace_path, ["commit", "-m=1"]) .success(); test_env .run_jj_in(&workspace_path, ["commit", "-m=2"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "root()"]) .success(); test_env .run_jj_in(&workspace_path, ["commit", "-m=a"]) .success(); test_env .run_jj_in(&workspace_path, ["commit", "-m=b"]) .success(); test_env .run_jj_in( &workspace_path, ["new", "description(2)", "description(b)", "-m=merged-head"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 1fb53c45237e merged-head parents: 2 b ├─╮ │ ○ a7bf5001cfd8 b parents: a │ ○ 6ca0450a05f5 a parents: ○ │ 1f81bd465ed0 2 parents: 1 ○ │ 0c058af014a6 1 parents: 0 ○ │ 745bea8029c1 0 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in(&workspace_path, ["parallelize", "description(1)::"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 82131a679769 merged-head parents: 0 b ├─╮ │ ○ a7bf5001cfd8 b parents: a │ ○ 6ca0450a05f5 a parents: │ │ ○ daef04bc3fae 2 parents: 0 ├───╯ │ │ ○ 0c058af014a6 1 parents: 0 ├───╯ ○ │ 745bea8029c1 0 parents: ├─╯ ◆ 000000000000 parents: [EOF] ");} #[test]fn test_parallelize_interior_target_is_a_merge() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["commit", "-m=0"]) .success(); test_env .run_jj_in(&workspace_path, ["describe", "-m=1"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "root()", "-m=a"]) .success(); test_env .run_jj_in( &workspace_path, ["new", "description(1)", "description(a)", "-m=2"], ) .success(); test_env .run_jj_in(&workspace_path, ["new", "-m=3"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 9b77792c77ac 3 parents: 2 ○ 1e29145c95fd 2 parents: 1 a ├─╮ │ ○ 427890ea3f2b a parents: ○ │ 0c058af014a6 1 parents: 0 ○ │ 745bea8029c1 0 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in(&workspace_path, ["parallelize", "description(1)::"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 042fc3f4315c 3 parents: 0 a ├─╮ │ │ ○ 80603361bb48 2 parents: 0 a ╭─┬─╯ │ ○ 427890ea3f2b a parents: │ │ ○ 0c058af014a6 1 parents: 0 ├───╯ ○ │ 745bea8029c1 0 parents: ├─╯ ◆ 000000000000 parents: [EOF] ");} #[test]fn test_parallelize_root_is_a_merge() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["describe", "-m=y"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "root()", "-m=x"]) .success(); test_env .run_jj_in( &workspace_path, ["new", "description(y)", "description(x)", "-m=1"], ) .success(); test_env .run_jj_in(&workspace_path, ["new", "-m=2"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "-m=3"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ cc239b744d01 3 parents: 2 ○ 2bf00c2ad44c 2 parents: 1 ○ 1c6853121f3c 1 parents: y x ├─╮ │ ○ 4035b23c8f72 x parents: ○ │ ca57511e158f y parents: ├─╯ ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(2)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 2c7fdfa00b38 3 parents: 1 2 ├─╮ │ ○ 3acbd32944d6 2 parents: y x │ ├─╮ ○ │ │ 1c6853121f3c 1 parents: y x ╰─┬─╮ │ ○ 4035b23c8f72 x parents: ○ │ ca57511e158f y parents: ├─╯ ◆ 000000000000 parents: [EOF] ");} #[test]fn test_parallelize_multiple_heads() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["commit", "-m=0"]) .success(); test_envLines 1–500 of 834. Load more
// Copyright 2024 The Jujutsu Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::path::Path; use crate::common::CommandOutput; use crate::common::TestEnvironment; #[test] fn test_parallelize_no_descendants() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..6 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["describe", "-m=6"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 02b7709cc4e9 6 parents: 5 ○ 1b2f08d76b66 5 parents: 4 ○ e5c4cf44e237 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in(&workspace_path, ["parallelize", "description(1)::"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 4850b4629edb 6 parents: │ ○ 87627fbb7d29 5 parents: ├─╯ │ ○ 5b9815e28fae 4 parents: ├─╯ │ ○ bb1bb465ccc2 3 parents: ├─╯ │ ○ 337eca1ef3a8 2 parents: ├─╯ │ ○ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); } // Only the head commit has descendants. #[test] fn test_parallelize_with_descendants_simple() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..6 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["describe", "-m=6"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 02b7709cc4e9 6 parents: 5 ○ 1b2f08d76b66 5 parents: 4 ○ e5c4cf44e237 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(4)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 9bc057f8b6e3 6 parents: 5 ○ 9e36a8afe793 5 parents: 1 2 3 4 ├─┬─┬─╮ │ │ │ ○ 5b9815e28fae 4 parents: │ │ ○ │ bb1bb465ccc2 3 parents: │ │ ├─╯ │ ○ │ 337eca1ef3a8 2 parents: │ ├─╯ ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); } // One of the commits being parallelized has a child that isn't being // parallelized. That child will become a merge of any ancestors which are being // parallelized. #[test] fn test_parallelize_where_interior_has_non_target_children() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..6 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["new", "description(2)", "-m=2c"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "description(5)", "-m=6"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 2508ea92308a 6 parents: 5 ○ 1b2f08d76b66 5 parents: 4 ○ e5c4cf44e237 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 │ ○ 3e7571e62c87 2c parents: 2 ├─╯ ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(4)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ c9525dff9d03 6 parents: 5 ○ b3ad09518546 5 parents: 1 2 3 4 ├─┬─┬─╮ │ │ │ ○ 3b125ed6a683 4 parents: │ │ ○ │ 1ed8c0c5be30 3 parents: │ │ ├─╯ │ │ │ ○ c01d8e85ea96 2c parents: 1 2 ╭─┬───╯ │ ○ │ 7efea6c89b60 2 parents: │ ├─╯ ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); } #[test] fn test_parallelize_where_root_has_non_target_children() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..4 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["new", "description(1)", "-m=1c"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "description(3)", "-m=4"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 9132691e6256 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 │ ○ 6c64110df0a5 1c parents: 1 ├─╯ ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(3)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 3397916989e7 4 parents: 1 2 3 ├─┬─╮ │ │ ○ 1f768c1bc591 3 parents: │ ○ │ 12ef12b4640e 2 parents: │ ├─╯ │ │ ○ 6c64110df0a5 1c parents: 1 ├───╯ ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); } // One of the commits being parallelized has a child that is a merge commit. #[test] fn test_parallelize_with_merge_commit_child() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["commit", "-m", "1"]) .success(); for n in 2..4 { test_env .run_jj_in(&workspace_path, ["commit", "-m", &n.to_string()]) .success(); } test_env .run_jj_in(&workspace_path, ["new", "root()", "-m", "a"]) .success(); test_env .run_jj_in( &workspace_path, ["new", "description(2)", "description(a)", "-m", "2a-c"], ) .success(); test_env .run_jj_in(&workspace_path, ["new", "description(3)", "-m", "4"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 99ffaf5b3984 4 parents: 3 ○ 4cd999dfaac0 3 parents: 2 │ ○ 4313cc3b476f 2a-c parents: 2 a ╭─┤ │ ○ 1eb902150bb9 a parents: ○ │ d3902619fade 2 parents: 1 ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); // After this finishes, child-2a will have three parents: "1", "2", and "a". test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(3)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 3ee9279847a6 4 parents: 1 2 3 ├─┬─╮ │ │ ○ bb1bb465ccc2 3 parents: │ │ │ ○ c70ee196514b 2a-c parents: 1 2 a ╭─┬───┤ │ │ │ ○ 1eb902150bb9 a parents: │ │ ├─╯ │ ○ │ 337eca1ef3a8 2 parents: │ ├─╯ ○ │ 8b64ddff700d 1 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); } #[test] fn test_parallelize_disconnected_target_commits() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); for n in 1..3 { test_env .run_jj_in(&workspace_path, ["commit", &format!("-m{n}")]) .success(); } test_env .run_jj_in(&workspace_path, ["describe", "-m=3"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); let output = test_env.run_jj_in( &workspace_path, ["parallelize", "description(1)", "description(3)"], ); insta::assert_snapshot!(output, @r" ------- stderr ------- Nothing changed. [EOF] "); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 4cd999dfaac0 3 parents: 2 ○ d3902619fade 2 parents: 1 ○ 8b64ddff700d 1 parents: ◆ 000000000000 parents: [EOF] "); } #[test] fn test_parallelize_head_is_a_merge() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["commit", "-m=0"]) .success(); test_env .run_jj_in(&workspace_path, ["commit", "-m=1"]) .success(); test_env .run_jj_in(&workspace_path, ["commit", "-m=2"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "root()"]) .success(); test_env .run_jj_in(&workspace_path, ["commit", "-m=a"]) .success(); test_env .run_jj_in(&workspace_path, ["commit", "-m=b"]) .success(); test_env .run_jj_in( &workspace_path, ["new", "description(2)", "description(b)", "-m=merged-head"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 1fb53c45237e merged-head parents: 2 b ├─╮ │ ○ a7bf5001cfd8 b parents: a │ ○ 6ca0450a05f5 a parents: ○ │ 1f81bd465ed0 2 parents: 1 ○ │ 0c058af014a6 1 parents: 0 ○ │ 745bea8029c1 0 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in(&workspace_path, ["parallelize", "description(1)::"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 82131a679769 merged-head parents: 0 b ├─╮ │ ○ a7bf5001cfd8 b parents: a │ ○ 6ca0450a05f5 a parents: │ │ ○ daef04bc3fae 2 parents: 0 ├───╯ │ │ ○ 0c058af014a6 1 parents: 0 ├───╯ ○ │ 745bea8029c1 0 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); } #[test] fn test_parallelize_interior_target_is_a_merge() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["commit", "-m=0"]) .success(); test_env .run_jj_in(&workspace_path, ["describe", "-m=1"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "root()", "-m=a"]) .success(); test_env .run_jj_in( &workspace_path, ["new", "description(1)", "description(a)", "-m=2"], ) .success(); test_env .run_jj_in(&workspace_path, ["new", "-m=3"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 9b77792c77ac 3 parents: 2 ○ 1e29145c95fd 2 parents: 1 a ├─╮ │ ○ 427890ea3f2b a parents: ○ │ 0c058af014a6 1 parents: 0 ○ │ 745bea8029c1 0 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in(&workspace_path, ["parallelize", "description(1)::"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 042fc3f4315c 3 parents: 0 a ├─╮ │ │ ○ 80603361bb48 2 parents: 0 a ╭─┬─╯ │ ○ 427890ea3f2b a parents: │ │ ○ 0c058af014a6 1 parents: 0 ├───╯ ○ │ 745bea8029c1 0 parents: ├─╯ ◆ 000000000000 parents: [EOF] "); } #[test] fn test_parallelize_root_is_a_merge() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["describe", "-m=y"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "root()", "-m=x"]) .success(); test_env .run_jj_in( &workspace_path, ["new", "description(y)", "description(x)", "-m=1"], ) .success(); test_env .run_jj_in(&workspace_path, ["new", "-m=2"]) .success(); test_env .run_jj_in(&workspace_path, ["new", "-m=3"]) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ cc239b744d01 3 parents: 2 ○ 2bf00c2ad44c 2 parents: 1 ○ 1c6853121f3c 1 parents: y x ├─╮ │ ○ 4035b23c8f72 x parents: ○ │ ca57511e158f y parents: ├─╯ ◆ 000000000000 parents: [EOF] "); test_env .run_jj_in( &workspace_path, ["parallelize", "description(1)::description(2)"], ) .success(); insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ 2c7fdfa00b38 3 parents: 1 2 ├─╮ │ ○ 3acbd32944d6 2 parents: y x │ ├─╮ ○ │ │ 1c6853121f3c 1 parents: y x ╰─┬─╮ │ ○ 4035b23c8f72 x parents: ○ │ ca57511e158f y parents: ├─╯ ◆ 000000000000 parents: [EOF] "); } #[test] fn test_parallelize_multiple_heads() { let test_env = TestEnvironment::default(); test_env.run_jj_in(".", ["git", "init", "repo"]).success(); let workspace_path = test_env.env_root().join("repo"); test_env .run_jj_in(&workspace_path, ["commit", "-m=0"]) .success(); test_env