diff --git a/CHANGELOG.md b/CHANGELOG.md index b634bb960..cca67bd3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). `--insert-before` options to customize the location of the duplicated revisions. +* `jj log` now displays the working-copy branch first. + * New `fork_point()` revset function can be used to obtain the fork point of multiple commits. diff --git a/cli/src/commands/log.rs b/cli/src/commands/log.rs index 22a5126f0..299624316 100644 --- a/cli/src/commands/log.rs +++ b/cli/src/commands/log.rs @@ -187,11 +187,21 @@ pub(crate) fn cmd_log( if !args.no_graph { let mut raw_output = formatter.raw()?; let mut graph = get_graphlog(graph_style, raw_output.as_mut()); - let forward_iter = TopoGroupedGraphIterator::new(revset.iter_graph()); - let iter: Box> = if args.reversed { - Box::new(ReverseGraphIterator::new(forward_iter)?) - } else { - Box::new(forward_iter) + let iter: Box> = { + let mut forward_iter = TopoGroupedGraphIterator::new(revset.iter_graph()); + // Emit the working-copy branch first, which is usually most + // interesting. This also helps stabilize output order. + if let Some(id) = workspace_command.get_wc_commit_id() { + let has_commit = revset.containing_fn(); + if has_commit(id)? { + forward_iter.prioritize_branch(id.clone()); + } + } + if args.reversed { + Box::new(ReverseGraphIterator::new(forward_iter)?) + } else { + Box::new(forward_iter) + } }; for node in iter.take(limit) { let (commit_id, edges) = node?; diff --git a/cli/tests/test_bookmark_command.rs b/cli/tests/test_bookmark_command.rs index 4f53ee979..0d1421e79 100644 --- a/cli/tests/test_bookmark_command.rs +++ b/cli/tests/test_bookmark_command.rs @@ -940,12 +940,12 @@ fn test_bookmark_track_untrack() { feature2@origin: sptzoqmo 7b33f629 commit 1 main@origin: sptzoqmo 7b33f629 commit 1 "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ◆ feature1@origin feature2@origin main@origin 7b33f6295eda - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 230dd059e1b0 + │ ◆ feature1@origin feature2@origin main@origin 7b33f6295eda ├─╯ ◆ 000000000000 - "###); + "#); // Track new bookmark. Local bookmark should be created. test_env.jj_cmd_ok( @@ -988,12 +988,12 @@ fn test_bookmark_track_untrack() { main: sptzoqmo 7b33f629 commit 1 @origin: sptzoqmo 7b33f629 commit 1 "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ◆ feature1 feature1@origin feature2@origin main 7b33f6295eda - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 230dd059e1b0 + │ ◆ feature1 feature1@origin feature2@origin main 7b33f6295eda ├─╯ ◆ 000000000000 - "###); + "#); // Fetch new commit. Only tracking bookmark "main" should be merged. create_remote_commit( @@ -1018,14 +1018,14 @@ fn test_bookmark_track_untrack() { main: mmqqkyyt 40dabdaf commit 2 @origin: mmqqkyyt 40dabdaf commit 2 "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ◆ feature1@origin feature2@origin main 40dabdaf4abe + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 230dd059e1b0 + │ ◆ feature1@origin feature2@origin main 40dabdaf4abe + ├─╯ │ ○ feature1 7b33f6295eda ├─╯ - │ @ 230dd059e1b0 - ├─╯ ◆ 000000000000 - "###); + "#); // Fetch new commit with auto tracking. Tracking bookmark "main" and new // bookmark "feature3" should be merged. @@ -1057,14 +1057,14 @@ fn test_bookmark_track_untrack() { main: wwnpyzpo 3f0f86fa commit 3 @origin: wwnpyzpo 3f0f86fa commit 3 "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ◆ feature1@origin feature2@origin feature3 main 3f0f86fa0e57 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 230dd059e1b0 + │ ◆ feature1@origin feature2@origin feature3 main 3f0f86fa0e57 + ├─╯ │ ○ feature1 7b33f6295eda ├─╯ - │ @ 230dd059e1b0 - ├─╯ ◆ 000000000000 - "###); + "#); } #[test] @@ -1447,9 +1447,9 @@ fn test_bookmark_list_filtered() { &local_path, &["log", "-r::(bookmarks() | remote_bookmarks())", "-T", template], ), - @r###" - ○ e31634b64294 remote-rewrite* - │ @ c7b4c09cd77c local-keep + @r#" + @ c7b4c09cd77c local-keep + │ ○ e31634b64294 remote-rewrite* ├─╯ │ ○ 3e9a5af6ef15 remote-rewrite@origin (hidden) ├─╯ @@ -1458,7 +1458,7 @@ fn test_bookmark_list_filtered() { │ ○ 911e912015fb remote-keep ├─╯ ◆ 000000000000 - "###); + "#); // All bookmarks are listed by default. let (stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["bookmark", "list"]); diff --git a/cli/tests/test_commit_template.rs b/cli/tests/test_commit_template.rs index 916b26fae..bd51a9bd3 100644 --- a/cli/tests/test_commit_template.rs +++ b/cli/tests/test_commit_template.rs @@ -503,26 +503,26 @@ fn test_log_evolog_divergence() { &["describe", "-m", "description 2", "--at-operation", "@-"], ); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log"]); - insta::assert_snapshot!(stdout, @r###" - ○ qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00 - │ description 2 - │ @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 - ├─╯ description 1 + insta::assert_snapshot!(stdout, @r#" + @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 + │ description 1 + │ ○ qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00 + ├─╯ description 2 ◆ zzzzzzzz root() 00000000 - "###); + "#); insta::assert_snapshot!(stderr, @r###" Concurrent modification detected, resolving automatically. "###); // Color let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]); - insta::assert_snapshot!(stdout, @r###" - ○ qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00 - │ description 2 - │ @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 - ├─╯ description 1 + insta::assert_snapshot!(stdout, @r#" + @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 + │ description 1 + │ ○ qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00 + ├─╯ description 2 ◆ zzzzzzzz root() 00000000 - "###); + "#); // Evolog and hidden divergent let stdout = test_env.jj_cmd_success(&repo_path, &["evolog"]); @@ -599,45 +599,45 @@ fn test_log_bookmarks() { let template = r#"commit_id.short() ++ " " ++ if(bookmarks, bookmarks, "(no bookmarks)")"#; let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); - insta::assert_snapshot!(output, @r###" - ○ fed794e2ba44 bookmark3?? bookmark3@origin + insta::assert_snapshot!(output, @r#" + @ a5b4d15489cc bookmark2* new-bookmark + ○ 8476341eb395 bookmark2@origin unchanged + │ ○ fed794e2ba44 bookmark3?? bookmark3@origin + ├─╯ │ ○ b1bb3766d584 bookmark3?? ├─╯ │ ○ 4a7e4246fc4d bookmark1* ├─╯ - │ @ a5b4d15489cc bookmark2* new-bookmark - │ ○ 8476341eb395 bookmark2@origin unchanged - ├─╯ ◆ 000000000000 (no bookmarks) - "###); + "#); let template = r#"bookmarks.map(|b| separate("/", b.remote(), b.name())).join(", ")"#; let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); - insta::assert_snapshot!(output, @r###" - ○ bookmark3, origin/bookmark3 + insta::assert_snapshot!(output, @r#" + @ bookmark2, new-bookmark + ○ origin/bookmark2, unchanged + │ ○ bookmark3, origin/bookmark3 + ├─╯ │ ○ bookmark3 ├─╯ │ ○ bookmark1 ├─╯ - │ @ bookmark2, new-bookmark - │ ○ origin/bookmark2, unchanged - ├─╯ ◆ - "###); + "#); let template = r#"separate(" ", "L:", local_bookmarks, "R:", remote_bookmarks)"#; let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); - insta::assert_snapshot!(output, @r###" - ○ L: bookmark3?? R: bookmark3@origin + insta::assert_snapshot!(output, @r#" + @ L: bookmark2* new-bookmark R: + ○ L: unchanged R: bookmark2@origin unchanged@origin + │ ○ L: bookmark3?? R: bookmark3@origin + ├─╯ │ ○ L: bookmark3?? R: ├─╯ │ ○ L: bookmark1* R: ├─╯ - │ @ L: bookmark2* new-bookmark R: - │ ○ L: unchanged R: bookmark2@origin unchanged@origin - ├─╯ ◆ L: R: - "###); + "#); let template = r#" remote_bookmarks.map(|ref| concat( diff --git a/cli/tests/test_concurrent_operations.rs b/cli/tests/test_concurrent_operations.rs index 89642be21..d64427d21 100644 --- a/cli/tests/test_concurrent_operations.rs +++ b/cli/tests/test_concurrent_operations.rs @@ -50,12 +50,12 @@ fn test_concurrent_operation_divergence() { // We should be informed about the concurrent modification let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "-T", "description"]); - insta::assert_snapshot!(stdout, @r###" - ○ message 2 - │ @ message 1 + insta::assert_snapshot!(stdout, @r#" + @ message 1 + │ ○ message 2 ├─╯ ◆ - "###); + "#); insta::assert_snapshot!(stderr, @r###" Concurrent modification detected, resolving automatically. "###); diff --git a/cli/tests/test_duplicate_command.rs b/cli/tests/test_duplicate_command.rs index a5e3601b5..7bb448a12 100644 --- a/cli/tests/test_duplicate_command.rs +++ b/cli/tests/test_duplicate_command.rs @@ -62,16 +62,16 @@ fn test_duplicate() { insta::assert_snapshot!(stderr, @r###" Duplicated 2443ea76b0b1 as kpqxywon f5b1e687 a "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ f5b1e68729d6 a - │ @ 17a00fc21654 c - │ ├─╮ - │ │ ○ d370aee184ba b - ├───╯ - │ ○ 2443ea76b0b1 a + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 17a00fc21654 c + ├─╮ + │ ○ d370aee184ba b + ○ │ 2443ea76b0b1 a + ├─╯ + │ ○ f5b1e68729d6 a ├─╯ ◆ 000000000000 - "###); + "#); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["undo"]); insta::assert_snapshot!(stdout, @""); @@ -83,16 +83,16 @@ fn test_duplicate() { insta::assert_snapshot!(stderr, @r###" Duplicated 17a00fc21654 as lylxulpl ef3b0f3d c "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ ef3b0f3d1046 c + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 17a00fc21654 c ├─╮ - │ │ @ 17a00fc21654 c + │ │ ○ ef3b0f3d1046 c ╭─┬─╯ │ ○ d370aee184ba b ○ │ 2443ea76b0b1 a ├─╯ ◆ 000000000000 - "###); + "#); } #[test] @@ -124,20 +124,20 @@ fn test_duplicate_many() { Duplicated 1394f625cbbd as wqnwkozp 3b74d969 b Duplicated 921dde6e55c0 as mouksmqu 8348ddce e "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ 8348ddcec733 e + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 921dde6e55c0 e ├─╮ - ○ │ 3b74d9691015 b - │ │ @ 921dde6e55c0 e + ○ │ 1394f625cbbd b + │ │ ○ 8348ddcec733 e │ ╭─┤ │ ○ │ ebd06dba20ec d │ ○ │ c0cb3a0b73e7 c ├─╯ │ - │ ○ 1394f625cbbd b + │ ○ 3b74d9691015 b ├───╯ ○ 2443ea76b0b1 a ◆ 000000000000 - "###); + "#); // Try specifying the same commit twice directly test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -146,18 +146,18 @@ fn test_duplicate_many() { insta::assert_snapshot!(stderr, @r###" Duplicated 1394f625cbbd as nkmrtpmo 0276d3d7 b "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ 0276d3d7c24d b - │ @ 921dde6e55c0 e - │ ├─╮ - │ │ ○ ebd06dba20ec d - │ │ ○ c0cb3a0b73e7 c - ├───╯ - │ ○ 1394f625cbbd b + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 921dde6e55c0 e + ├─╮ + │ ○ ebd06dba20ec d + │ ○ c0cb3a0b73e7 c + ○ │ 1394f625cbbd b + ├─╯ + │ ○ 0276d3d7c24d b ├─╯ ○ 2443ea76b0b1 a ◆ 000000000000 - "###); + "#); // Try specifying the same commit twice indirectly test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -168,22 +168,22 @@ fn test_duplicate_many() { Duplicated ebd06dba20ec as pqrnrkux 2181781b d Duplicated 921dde6e55c0 as ztxkyksq 0f7430f2 e "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ 0f7430f2727a e + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 921dde6e55c0 e ├─╮ - │ ○ 2181781b4f81 d - ○ │ fa167d18a83a b - │ │ @ 921dde6e55c0 e + │ ○ ebd06dba20ec d + ○ │ 1394f625cbbd b + │ │ ○ 0f7430f2727a e │ │ ├─╮ - │ │ │ ○ ebd06dba20ec d + │ │ │ ○ 2181781b4f81 d │ ├───╯ │ ○ │ c0cb3a0b73e7 c ├─╯ │ - │ ○ 1394f625cbbd b + │ ○ fa167d18a83a b ├───╯ ○ 2443ea76b0b1 a ◆ 000000000000 - "###); + "#); test_env.jj_cmd_ok(&repo_path, &["undo"]); // Reminder of the setup @@ -204,13 +204,13 @@ fn test_duplicate_many() { Duplicated ebd06dba20ec as plymsszl d94e4c55 d Duplicated 921dde6e55c0 as urrlptpw 9bd4389f e "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ 9bd4389f5d47 e + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 921dde6e55c0 e ├─╮ - │ ○ d94e4c55a68b d - │ │ @ 921dde6e55c0 e + │ ○ ebd06dba20ec d + │ │ ○ 9bd4389f5d47 e ╭───┤ - │ │ ○ ebd06dba20ec d + │ │ ○ d94e4c55a68b d │ ├─╯ │ ○ c0cb3a0b73e7 c ○ │ 1394f625cbbd b @@ -219,7 +219,7 @@ fn test_duplicate_many() { │ ○ c6f7f8c4512e a ├─╯ ◆ 000000000000 - "###); + "#); // Check for BUG -- makes too many 'a'-s, etc. test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -232,24 +232,24 @@ fn test_duplicate_many() { Duplicated ebd06dba20ec as yxrlprzz 2f2442db d Duplicated 921dde6e55c0 as mvkzkxrl ee8fe64e e "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ ee8fe64ed254 e + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 921dde6e55c0 e ├─╮ - │ ○ 2f2442db08eb d - │ ○ df53fa589286 c - ○ │ e13ac0adabdf b + │ ○ ebd06dba20ec d + │ ○ c0cb3a0b73e7 c + ○ │ 1394f625cbbd b ├─╯ - ○ 0fe67a05989e a - │ @ 921dde6e55c0 e + ○ 2443ea76b0b1 a + │ ○ ee8fe64ed254 e │ ├─╮ - │ │ ○ ebd06dba20ec d - │ │ ○ c0cb3a0b73e7 c - │ ○ │ 1394f625cbbd b + │ │ ○ 2f2442db08eb d + │ │ ○ df53fa589286 c + │ ○ │ e13ac0adabdf b │ ├─╯ - │ ○ 2443ea76b0b1 a + │ ○ 0fe67a05989e a ├─╯ ◆ 000000000000 - "###); + "#); } #[test] @@ -286,10 +286,10 @@ fn test_duplicate_destination() { insta::assert_snapshot!(stderr, @r#" Duplicated 9e85a474f005 as nkmrtpmo 4587e554 a1 "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 4587e554fef9 a1 - ○ b75b7aa4b90e c - │ @ f7550bb42c6f d + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ f7550bb42c6f d + │ ○ 4587e554fef9 a1 + │ ○ b75b7aa4b90e c ├─╯ │ ○ 9a27d5939bef b ├─╯ @@ -298,7 +298,7 @@ fn test_duplicate_destination() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit onto multiple destinations. @@ -331,19 +331,19 @@ fn test_duplicate_destination() { Warning: Duplicating commit 9e85a474f005 as a descendant of itself Duplicated 9e85a474f005 as wvuyspvk 5b3cf5a5 a1 "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 5b3cf5a5cbc2 a1 - ○ 17072aa2b823 a3 - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ f7550bb42c6f d - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ f7550bb42c6f d │ ○ b75b7aa4b90e c ├─╯ │ ○ 9a27d5939bef b ├─╯ + │ ○ 5b3cf5a5cbc2 a1 + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship onto a @@ -354,12 +354,12 @@ fn test_duplicate_destination() { Duplicated 9e85a474f005 as xlzxqlsl 30bff9b1 a1 Duplicated 9a27d5939bef as vnkwvqxw c7016240 b "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ c7016240cc66 b - │ ○ 30bff9b13575 a1 - ├─╯ - ○ b75b7aa4b90e c - │ @ f7550bb42c6f d + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ f7550bb42c6f d + │ ○ c7016240cc66 b + │ │ ○ 30bff9b13575 a1 + │ ├─╯ + │ ○ b75b7aa4b90e c ├─╯ │ ○ 9a27d5939bef b ├─╯ @@ -368,7 +368,7 @@ fn test_duplicate_destination() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship onto @@ -406,11 +406,11 @@ fn test_duplicate_destination() { Duplicated 9e85a474f005 as wtszoswq 58411bed a1 Duplicated 17072aa2b823 as qmykwtmu 86842c96 a3 "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 86842c96d8c8 a3 - ○ 58411bed3598 a1 - ○ b75b7aa4b90e c - │ @ f7550bb42c6f d + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ f7550bb42c6f d + │ ○ 86842c96d8c8 a3 + │ ○ 58411bed3598 a1 + │ ○ b75b7aa4b90e c ├─╯ │ ○ 9a27d5939bef b ├─╯ @@ -419,7 +419,7 @@ fn test_duplicate_destination() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship onto @@ -491,23 +491,23 @@ fn test_duplicate_insert_after() { Duplicated 9e85a474f005 as pzsxstzt b34eead0 a1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ a384ab7ad1f6 b2 - ○ b34eead0fdf5 a1 - ○ dcc98bc8bbea b1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ + │ ○ a384ab7ad1f6 b2 + │ ○ b34eead0fdf5 a1 + │ ○ dcc98bc8bbea b1 + ├─╯ │ ○ 196bc1f0efc1 a4 │ ○ 17072aa2b823 a3 │ ○ 47df67757a64 a2 │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit after a single ancestor commit. @@ -518,23 +518,23 @@ fn test_duplicate_insert_after() { Duplicated 17072aa2b823 as qmkrwlvp c167d08f a3 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 8746d17a44cb a4 - ○ 15a695f5bf13 a3 - ○ 73e26c9e22e7 a2 - ○ c167d08f8d9f a3 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 8746d17a44cb a4 + │ ○ 15a695f5bf13 a3 + │ ○ 73e26c9e22e7 a2 + │ ○ c167d08f8d9f a3 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit after a single descendant commit. @@ -545,23 +545,23 @@ fn test_duplicate_insert_after() { Duplicated 9e85a474f005 as qwyusntz 074debdf a1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 3fcf9fdec8f3 a4 - ○ 074debdf330b a1 - ○ 17072aa2b823 a3 - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 3fcf9fdec8f3 a4 + │ ○ 074debdf330b a1 + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit after multiple commits with no direct @@ -575,17 +575,17 @@ fn test_duplicate_insert_after() { Duplicated 9e85a474f005 as soqnvnyz 671da6dc a1 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 35ccc31b58bd c2 - │ ○ 7951d1641b4b b2 - ├─╯ - ○ 671da6dc2d2e a1 - ├─╮ - │ ○ b27346e9a9bd c1 - ○ │ dcc98bc8bbea b1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 35ccc31b58bd c2 + │ │ ○ 7951d1641b4b b2 + │ ├─╯ + │ ○ 671da6dc2d2e a1 + │ ├─╮ + │ │ ○ b27346e9a9bd c1 + ├───╯ + │ ○ dcc98bc8bbea b1 ├─╯ │ ○ 196bc1f0efc1 a4 │ ○ 17072aa2b823 a3 @@ -593,7 +593,7 @@ fn test_duplicate_insert_after() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit after multiple commits including an ancestor. @@ -607,24 +607,24 @@ fn test_duplicate_insert_after() { Duplicated 17072aa2b823 as nsrwusvy 727c43ec a3 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 5ae709b39efb a4 - ○ ecb0aa61feab a3 - ○ 727c43ec8eaa a3 - ├─╮ - │ ○ 7b44470918f4 b2 - │ ○ dcc98bc8bbea b1 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ + │ ○ 5ae709b39efb a4 + │ ○ ecb0aa61feab a3 + │ ○ 727c43ec8eaa a3 + │ ├─╮ + │ │ ○ 7b44470918f4 b2 + │ │ ○ dcc98bc8bbea b1 + ├───╯ + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit after multiple commits including a descendant. @@ -638,24 +638,24 @@ fn test_duplicate_insert_after() { Duplicated 9e85a474f005 as xpnwykqz 6944eeac a1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 4fa1dfb1735f a4 - ○ 6944eeac206a a1 - ├─╮ - │ ○ 7b44470918f4 b2 - │ ○ dcc98bc8bbea b1 - ○ │ 17072aa2b823 a3 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ + │ ○ 4fa1dfb1735f a4 + │ ○ 6944eeac206a a1 + │ ├─╮ + │ │ ○ 7b44470918f4 b2 + │ │ ○ dcc98bc8bbea b1 + ├───╯ + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship after a @@ -668,15 +668,15 @@ fn test_duplicate_insert_after() { Duplicated dcc98bc8bbea as pxnqtknr 21b26c06 b1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ e9f2b664654b c2 - ├─╮ - │ ○ 21b26c06639f b1 - ○ │ d3dda93b8e6f a1 - ├─╯ - ○ b27346e9a9bd c1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ e9f2b664654b c2 + │ ├─╮ + │ │ ○ 21b26c06639f b1 + │ ○ │ d3dda93b8e6f a1 + │ ├─╯ + │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 @@ -687,7 +687,7 @@ fn test_duplicate_insert_after() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship after a @@ -701,26 +701,26 @@ fn test_duplicate_insert_after() { Duplicated dcc98bc8bbea as yqnpwwmq f18498f2 b1 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 5b30b2d24181 a4 - ○ 2725567328bd a3 - ├─╮ - │ ○ f18498f24737 b1 - ○ │ 0d11d4667aa9 a3 - ├─╯ - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 5b30b2d24181 a4 + │ ○ 2725567328bd a3 + │ ├─╮ + │ │ ○ f18498f24737 b1 + │ ○ │ 0d11d4667aa9 a3 + │ ├─╯ + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship after a @@ -734,26 +734,26 @@ fn test_duplicate_insert_after() { Duplicated dcc98bc8bbea as uukzylyy 7366036f b1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ b19d9559f21a a4 - ├─╮ - │ ○ 7366036f148d b1 - ○ │ b7458ffedb08 a1 - ├─╯ - ○ 17072aa2b823 a3 - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ b19d9559f21a a4 + │ ├─╮ + │ │ ○ 7366036f148d b1 + │ ○ │ b7458ffedb08 a1 + │ ├─╯ + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship after @@ -809,28 +809,28 @@ fn test_duplicate_insert_after() { Duplicated dcc98bc8bbea as musouqkq 560e532e b1 Rebased 4 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ c1d222b0e288 c2 - ├─╮ - │ │ ○ 0a31f366f5a2 a4 - │ │ ○ 06750de0d803 a3 - │ │ ○ 031778a0e9f3 a2 - ╭─┬─╯ - │ ○ 560e532ebd75 b1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ c1d222b0e288 c2 │ ├─╮ - ○ │ │ ccda812e23c4 a3 - ╰─┬─╮ - │ ○ b27346e9a9bd c1 - ○ │ 9e85a474f005 a1 - ├─╯ - @ │ 0cdd923e993a d2 - ○ │ 0f21c5e185c5 d1 - ├─╯ + │ │ │ ○ 0a31f366f5a2 a4 + │ │ │ ○ 06750de0d803 a3 + │ │ │ ○ 031778a0e9f3 a2 + │ ╭─┬─╯ + │ │ ○ 560e532ebd75 b1 + │ │ ├─╮ + │ ○ │ │ ccda812e23c4 a3 + │ ╰─┬─╮ + │ │ ○ b27346e9a9bd c1 + ├─────╯ + │ ○ 9e85a474f005 a1 + ├───╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship after @@ -846,27 +846,27 @@ fn test_duplicate_insert_after() { Duplicated dcc98bc8bbea as prukwozq dfe5dcad b1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 2db9fa035611 a4 - ├─╮ - │ ○ dfe5dcad355b b1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 2db9fa035611 a4 │ ├─╮ - ○ │ │ b6a5e31daed5 a1 - ╰─┬─╮ - │ ○ 09560d60cac4 c2 - │ ○ b27346e9a9bd c1 - ○ │ 17072aa2b823 a3 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - @ │ 0cdd923e993a d2 - ○ │ 0f21c5e185c5 d1 - ├─╯ + │ │ ○ dfe5dcad355b b1 + │ │ ├─╮ + │ ○ │ │ b6a5e31daed5 a1 + │ ╰─┬─╮ + │ │ ○ 09560d60cac4 c2 + │ │ ○ b27346e9a9bd c1 + ├─────╯ + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├───╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship after a single @@ -878,13 +878,13 @@ fn test_duplicate_insert_after() { Duplicated 9e85a474f005 as vvvtksvt 940b5139 a1 Duplicated 17072aa2b823 as yvrnrpnw 9d985606 a3 "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 9d9856065046 a3 - ○ 940b51398e5d a1 - ○ 09560d60cac4 c2 - ○ b27346e9a9bd c1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 9d9856065046 a3 + │ ○ 940b51398e5d a1 + │ ○ 09560d60cac4 c2 + │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 @@ -895,7 +895,7 @@ fn test_duplicate_insert_after() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship after a single @@ -910,24 +910,24 @@ fn test_duplicate_insert_after() { Duplicated 17072aa2b823 as rxnrppxl 47586b09 a3 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 2174f54d55a9 a4 - ○ 0224bfb4fc3d a3 - ○ 22d3bdc60967 a2 - ○ 47586b09a555 a3 - ○ 4324d289e62c a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 2174f54d55a9 a4 + │ ○ 0224bfb4fc3d a3 + │ ○ 22d3bdc60967 a2 + │ ○ 47586b09a555 a3 + │ ○ 4324d289e62c a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship after a single @@ -942,24 +942,24 @@ fn test_duplicate_insert_after() { Duplicated 47df67757a64 as nqtyztop a80a88f5 a2 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ d1f47b881c72 a4 - ○ a80a88f5c6d6 a2 - ○ 08e917fe904c a1 - ○ 17072aa2b823 a3 - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ d1f47b881c72 a4 + │ ○ a80a88f5c6d6 a2 + │ ○ 08e917fe904c a1 + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship after multiple @@ -1008,25 +1008,25 @@ fn test_duplicate_insert_after() { Duplicated 196bc1f0efc1 as puxpuzrm 71d9b4a4 a4 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ fc18e2f00060 a4 - ○ bc2303a7d63e a3 - ○ 71d9b4a48273 a4 - ○ 9d8de4c3ad3e a3 - ├─╮ - │ ○ 09560d60cac4 c2 - │ ○ b27346e9a9bd c1 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ fc18e2f00060 a4 + │ ○ bc2303a7d63e a3 + │ ○ 71d9b4a48273 a4 + │ ○ 9d8de4c3ad3e a3 + │ ├─╮ + │ │ ○ 09560d60cac4 c2 + │ │ ○ b27346e9a9bd c1 + ├───╯ + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship after multiple @@ -1043,25 +1043,25 @@ fn test_duplicate_insert_after() { Duplicated 47df67757a64 as znsksvls 0b619bbb a2 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 5006826a3086 a4 - ○ 0b619bbbe823 a2 - ○ cc0bfcbe97fe a1 - ├─╮ - │ ○ 09560d60cac4 c2 - │ ○ b27346e9a9bd c1 - ○ │ 17072aa2b823 a3 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 5006826a3086 a4 + │ ○ 0b619bbbe823 a2 + │ ○ cc0bfcbe97fe a1 + │ ├─╮ + │ │ ○ 09560d60cac4 c2 + │ │ ○ b27346e9a9bd c1 + ├───╯ + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Should error if a loop will be created. @@ -1117,23 +1117,23 @@ fn test_duplicate_insert_before() { Duplicated 9e85a474f005 as pzsxstzt b34eead0 a1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ a384ab7ad1f6 b2 - ○ b34eead0fdf5 a1 - ○ dcc98bc8bbea b1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ + │ ○ a384ab7ad1f6 b2 + │ ○ b34eead0fdf5 a1 + │ ○ dcc98bc8bbea b1 + ├─╯ │ ○ 196bc1f0efc1 a4 │ ○ 17072aa2b823 a3 │ ○ 47df67757a64 a2 │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit before a single ancestor commit. @@ -1144,14 +1144,14 @@ fn test_duplicate_insert_before() { Duplicated 17072aa2b823 as qmkrwlvp a982be78 a3 Rebased 4 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 09981b821640 a4 - ○ 7f96a38d7b7b a3 - ○ d37b384f7ce9 a2 - ○ 4a0df1f03819 a1 - ○ a982be787d28 a3 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 09981b821640 a4 + │ ○ 7f96a38d7b7b a3 + │ ○ d37b384f7ce9 a2 + │ ○ 4a0df1f03819 a1 + │ ○ a982be787d28 a3 ├─╯ │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 @@ -1160,7 +1160,7 @@ fn test_duplicate_insert_before() { │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit before a single descendant commit. @@ -1171,23 +1171,23 @@ fn test_duplicate_insert_before() { Duplicated 9e85a474f005 as qwyusntz 2b066074 a1 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 34812a9db795 a4 - ○ b42fc445deeb a3 - ○ 2b0660740e57 a1 - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 34812a9db795 a4 + │ ○ b42fc445deeb a3 + │ ○ 2b0660740e57 a1 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit before multiple commits with no direct @@ -1201,17 +1201,17 @@ fn test_duplicate_insert_before() { Duplicated 9e85a474f005 as soqnvnyz 671da6dc a1 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 35ccc31b58bd c2 - │ ○ 7951d1641b4b b2 - ├─╯ - ○ 671da6dc2d2e a1 - ├─╮ - │ ○ b27346e9a9bd c1 - ○ │ dcc98bc8bbea b1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 35ccc31b58bd c2 + │ │ ○ 7951d1641b4b b2 + │ ├─╯ + │ ○ 671da6dc2d2e a1 + │ ├─╮ + │ │ ○ b27346e9a9bd c1 + ├───╯ + │ ○ dcc98bc8bbea b1 ├─╯ │ ○ 196bc1f0efc1 a4 │ ○ 17072aa2b823 a3 @@ -1219,7 +1219,7 @@ fn test_duplicate_insert_before() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit before multiple commits including an ancestor. @@ -1233,25 +1233,25 @@ fn test_duplicate_insert_before() { Duplicated 17072aa2b823 as nsrwusvy 851a34a3 a3 Rebased 4 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 3a9373464406 b2 - │ ○ 8774e5674831 a4 - │ ○ f3d3a1617059 a3 - │ ○ f207ecb81650 a2 - ├─╯ - ○ 851a34a36354 a3 - ├─╮ - │ ○ dcc98bc8bbea b1 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ + │ ○ 3a9373464406 b2 + │ │ ○ 8774e5674831 a4 + │ │ ○ f3d3a1617059 a3 + │ │ ○ f207ecb81650 a2 + │ ├─╯ + │ ○ 851a34a36354 a3 + │ ├─╮ + │ │ ○ dcc98bc8bbea b1 + ├───╯ + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit before multiple commits including a descendant. @@ -1265,25 +1265,25 @@ fn test_duplicate_insert_before() { Duplicated 9e85a474f005 as xpnwykqz af64c5e4 a1 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ f9f4cbe12efc b2 - │ ○ e8057839c645 a4 - │ ○ aa3ce5a43997 a3 - ├─╯ - ○ af64c5e44fc7 a1 - ├─╮ - │ ○ dcc98bc8bbea b1 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ + │ ○ f9f4cbe12efc b2 + │ │ ○ e8057839c645 a4 + │ │ ○ aa3ce5a43997 a3 + │ ├─╯ + │ ○ af64c5e44fc7 a1 + │ ├─╮ + │ │ ○ dcc98bc8bbea b1 + ├───╯ + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship before a @@ -1296,15 +1296,15 @@ fn test_duplicate_insert_before() { Duplicated dcc98bc8bbea as pxnqtknr 2233b9a8 b1 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ cf7c4c4cc8bc c2 - ○ 6412acdac711 c1 - ├─╮ - │ ○ 2233b9a87d86 b1 - ○ │ fa625d74e0ae a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ cf7c4c4cc8bc c2 + │ ○ 6412acdac711 c1 + │ ├─╮ + │ │ ○ 2233b9a87d86 b1 + ├───╯ + │ ○ fa625d74e0ae a1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 @@ -1315,7 +1315,7 @@ fn test_duplicate_insert_before() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship before a @@ -1329,26 +1329,26 @@ fn test_duplicate_insert_before() { Duplicated dcc98bc8bbea as yqnpwwmq 529ab44a b1 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ eb4ddce3bfef a4 - ○ b0b76f7bedf8 a3 - ○ b5fdef30de16 a2 - ├─╮ - │ ○ 529ab44a81ed b1 - ○ │ 0a1027765fdd a3 - ├─╯ - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ eb4ddce3bfef a4 + │ ○ b0b76f7bedf8 a3 + │ ○ b5fdef30de16 a2 + │ ├─╮ + │ │ ○ 529ab44a81ed b1 + │ ○ │ 0a1027765fdd a3 + │ ├─╯ + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship before a @@ -1362,26 +1362,26 @@ fn test_duplicate_insert_before() { Duplicated dcc98bc8bbea as uukzylyy 63ba24cf b1 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 84d66cf1a667 a4 - ○ 733e5aa5ee67 a3 - ├─╮ - │ ○ 63ba24cf71df b1 - ○ │ 7502d2419a00 a1 - ├─╯ - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 84d66cf1a667 a4 + │ ○ 733e5aa5ee67 a3 + │ ├─╮ + │ │ ○ 63ba24cf71df b1 + │ ○ │ 7502d2419a00 a1 + │ ├─╯ + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship before @@ -1434,26 +1434,26 @@ fn test_duplicate_insert_before() { Duplicated dcc98bc8bbea as musouqkq 4748cf83 b1 Rebased 6 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ a86830bda155 c2 - ○ dfa992eb0c5b c1 - ├─╮ - │ │ ○ 2a975bb6fb8d a4 - │ │ ○ bd65348afea2 a3 - │ │ ○ 5aaf2e32fe6e a2 - │ │ ○ c1841f6cb78b a1 - ╭─┬─╯ - │ ○ 4748cf83e26e b1 - ○ │ 4aef02939dcb a3 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ a86830bda155 c2 + │ ○ dfa992eb0c5b c1 + │ ├─╮ + │ │ │ ○ 2a975bb6fb8d a4 + │ │ │ ○ bd65348afea2 a3 + │ │ │ ○ 5aaf2e32fe6e a2 + │ │ │ ○ c1841f6cb78b a1 + │ ╭─┬─╯ + │ │ ○ 4748cf83e26e b1 + ├───╯ + │ ○ 4aef02939dcb a3 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship before @@ -1469,28 +1469,28 @@ fn test_duplicate_insert_before() { Duplicated dcc98bc8bbea as prukwozq 8175fcec b1 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 7a485e3977a8 c2 - ├─╮ - │ │ ○ e5464cd6273d a4 - │ │ ○ e7bb732c469e a3 - ╭─┬─╯ - │ ○ 8175fcec2ded b1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 7a485e3977a8 c2 │ ├─╮ - ○ │ │ 024440c4a5da a1 - ╰─┬─╮ - │ ○ b27346e9a9bd c1 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - @ │ 0cdd923e993a d2 - ○ │ 0f21c5e185c5 d1 - ├─╯ + │ │ │ ○ e5464cd6273d a4 + │ │ │ ○ e7bb732c469e a3 + │ ╭─┬─╯ + │ │ ○ 8175fcec2ded b1 + │ │ ├─╮ + │ ○ │ │ 024440c4a5da a1 + │ ╰─┬─╮ + │ │ ○ b27346e9a9bd c1 + ├─────╯ + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├───╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship before a single @@ -1503,13 +1503,13 @@ fn test_duplicate_insert_before() { Duplicated 17072aa2b823 as yvrnrpnw 441a2568 a3 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 756972984dac c2 - ○ 441a25683840 a3 - ○ ad5a3d824060 a1 - ○ b27346e9a9bd c1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 756972984dac c2 + │ ○ 441a25683840 a3 + │ ○ ad5a3d824060 a1 + │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 @@ -1520,7 +1520,7 @@ fn test_duplicate_insert_before() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship before a single @@ -1535,15 +1535,15 @@ fn test_duplicate_insert_before() { Duplicated 17072aa2b823 as rxnrppxl b72e2eaa a3 Rebased 4 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ de1a87f140d9 a4 - ○ 3b405d96fbfb a3 - ○ 41677a1f0572 a2 - ○ 00c6a7cebcdb a1 - ○ b72e2eaa3f7f a3 - ○ ad0234a34661 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ de1a87f140d9 a4 + │ ○ 3b405d96fbfb a3 + │ ○ 41677a1f0572 a2 + │ ○ 00c6a7cebcdb a1 + │ ○ b72e2eaa3f7f a3 + │ ○ ad0234a34661 a1 ├─╯ │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 @@ -1552,7 +1552,7 @@ fn test_duplicate_insert_before() { │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship before a single @@ -1567,24 +1567,24 @@ fn test_duplicate_insert_before() { Duplicated 47df67757a64 as nqtyztop bddcdcd1 a2 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 13038f9969fa a4 - ○ 327c3bc13b75 a3 - ○ bddcdcd1ef61 a2 - ○ 2fdd3c3dabfc a1 - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 13038f9969fa a4 + │ ○ 327c3bc13b75 a3 + │ ○ bddcdcd1ef61 a2 + │ ○ 2fdd3c3dabfc a1 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship before multiple @@ -1638,26 +1638,26 @@ fn test_duplicate_insert_before() { Duplicated 196bc1f0efc1 as puxpuzrm 196c76cf a4 Rebased 4 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ d7ea487131da c2 - │ ○ f8d49609e8d8 a4 - │ ○ e3d75d821d33 a3 - │ ○ 23d8d39dd2d1 a2 - ├─╯ - ○ 196c76cf739f a4 - ○ c7b7f78f8924 a3 - ├─╮ - │ ○ b27346e9a9bd c1 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ d7ea487131da c2 + │ │ ○ f8d49609e8d8 a4 + │ │ ○ e3d75d821d33 a3 + │ │ ○ 23d8d39dd2d1 a2 + │ ├─╯ + │ ○ 196c76cf739f a4 + │ ○ c7b7f78f8924 a3 + │ ├─╮ + │ │ ○ b27346e9a9bd c1 + ├───╯ + │ ○ 9e85a474f005 a1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship before multiple @@ -1674,26 +1674,26 @@ fn test_duplicate_insert_before() { Duplicated 47df67757a64 as znsksvls 37c5c955 a2 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ d269d405ab74 c2 - │ ○ 175de6d6b816 a4 - │ ○ cdd9df354b86 a3 - ├─╯ - ○ 37c5c955a90a a2 - ○ 26d71f93323b a1 - ├─╮ - │ ○ b27346e9a9bd c1 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ d269d405ab74 c2 + │ │ ○ 175de6d6b816 a4 + │ │ ○ cdd9df354b86 a3 + │ ├─╯ + │ ○ 37c5c955a90a a2 + │ ○ 26d71f93323b a1 + │ ├─╮ + │ │ ○ b27346e9a9bd c1 + ├───╯ + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Should error if a loop will be created. @@ -1752,16 +1752,16 @@ fn test_duplicate_insert_after_before() { Duplicated 9e85a474f005 as pzsxstzt d5ebd2c8 a1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 20cc68b3be82 b2 - ├─╮ - │ ○ d5ebd2c814fb a1 - │ ○ 09560d60cac4 c2 - │ ○ b27346e9a9bd c1 - ○ │ dcc98bc8bbea b1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 20cc68b3be82 b2 + │ ├─╮ + │ │ ○ d5ebd2c814fb a1 + │ │ ○ 09560d60cac4 c2 + │ │ ○ b27346e9a9bd c1 + ├───╯ + │ ○ dcc98bc8bbea b1 ├─╯ │ ○ 196bc1f0efc1 a4 │ ○ 17072aa2b823 a3 @@ -1769,7 +1769,7 @@ fn test_duplicate_insert_after_before() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit in between ancestor commits. @@ -1783,23 +1783,23 @@ fn test_duplicate_insert_after_before() { Duplicated 17072aa2b823 as qmkrwlvp c167d08f a3 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 8746d17a44cb a4 - ○ 15a695f5bf13 a3 - ○ 73e26c9e22e7 a2 - ○ c167d08f8d9f a3 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 8746d17a44cb a4 + │ ○ 15a695f5bf13 a3 + │ ○ 73e26c9e22e7 a2 + │ ○ c167d08f8d9f a3 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit in between an ancestor commit and a commit with no @@ -1814,24 +1814,24 @@ fn test_duplicate_insert_after_before() { Duplicated 17072aa2b823 as qwyusntz 0481e43c a3 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 68632a4645b3 a4 - ○ 61736eaab064 a3 - ○ b8822ec79abf a2 - ├─╮ - │ ○ 0481e43c0ba7 a3 - │ ○ 7b44470918f4 b2 - │ ○ dcc98bc8bbea b1 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ + │ ○ 68632a4645b3 a4 + │ ○ 61736eaab064 a3 + │ ○ b8822ec79abf a2 + │ ├─╮ + │ │ ○ 0481e43c0ba7 a3 + │ │ ○ 7b44470918f4 b2 + │ │ ○ dcc98bc8bbea b1 + ├───╯ + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit in between descendant commits. @@ -1845,23 +1845,23 @@ fn test_duplicate_insert_after_before() { Duplicated 9e85a474f005 as soqnvnyz 981c26cf a1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 53de53f5df1d a4 - ○ 981c26cf1d8c a1 - ○ 17072aa2b823 a3 - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 53de53f5df1d a4 + │ ○ 981c26cf1d8c a1 + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit in between a descendant commit and a commit with no @@ -1876,25 +1876,25 @@ fn test_duplicate_insert_after_before() { Duplicated 9e85a474f005 as nsrwusvy e4ec1bed a1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 0ec3be87fae7 b2 - ├─╮ - │ ○ e4ec1bed0e7c a1 - ○ │ dcc98bc8bbea b1 - │ │ @ 0cdd923e993a d2 - │ │ ○ 0f21c5e185c5 d1 - ├───╯ - │ │ ○ 09560d60cac4 c2 - │ │ ○ b27346e9a9bd c1 - ├───╯ - │ │ ○ 196bc1f0efc1 a4 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 09560d60cac4 c2 + │ ○ b27346e9a9bd c1 + ├─╯ + │ ○ 0ec3be87fae7 b2 + │ ├─╮ + │ │ ○ e4ec1bed0e7c a1 + │ ○ │ dcc98bc8bbea b1 + ├─╯ │ + │ ○ │ 196bc1f0efc1 a4 │ ├─╯ │ ○ 17072aa2b823 a3 │ ○ 47df67757a64 a2 │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate a single commit in between an ancestor commit and a descendant @@ -1908,25 +1908,25 @@ fn test_duplicate_insert_after_before() { Duplicated 47df67757a64 as xpnwykqz 54cc0161 a2 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ b08d6199fab9 a4 - ├─╮ - │ ○ 54cc0161a5db a2 - ○ │ 17072aa2b823 a3 - ○ │ 47df67757a64 a2 - ├─╯ - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ b08d6199fab9 a4 + │ ├─╮ + │ │ ○ 54cc0161a5db a2 + │ ○ │ 17072aa2b823 a3 + │ ○ │ 47df67757a64 a2 + │ ├─╯ + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship between @@ -1982,27 +1982,27 @@ fn test_duplicate_insert_after_before() { Duplicated dcc98bc8bbea as yqnpwwmq f18498f2 b1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ da87b56a17e4 c2 - ├─┬─╮ - │ │ ○ f18498f24737 b1 - │ ○ │ 0d11d4667aa9 a3 - │ ├─╯ - ○ │ b27346e9a9bd c1 - │ │ @ 0cdd923e993a d2 - │ │ ○ 0f21c5e185c5 d1 - ├───╯ - │ │ ○ 7b44470918f4 b2 - │ │ ○ dcc98bc8bbea b1 - ├───╯ - │ │ ○ 196bc1f0efc1 a4 - │ │ ○ 17072aa2b823 a3 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ da87b56a17e4 c2 + │ ├─┬─╮ + │ │ │ ○ f18498f24737 b1 + │ │ ○ │ 0d11d4667aa9 a3 + │ │ ├─╯ + │ ○ │ b27346e9a9bd c1 + ├─╯ │ + │ ○ │ 7b44470918f4 b2 + │ ○ │ dcc98bc8bbea b1 + ├─╯ │ + │ ○ │ 196bc1f0efc1 a4 + │ ○ │ 17072aa2b823 a3 │ ├─╯ │ ○ 47df67757a64 a2 │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship between a @@ -2019,27 +2019,27 @@ fn test_duplicate_insert_after_before() { Duplicated dcc98bc8bbea as uukzylyy 7366036f b1 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 61237f8ed16f c2 - ├─┬─╮ - │ │ ○ 7366036f148d b1 - │ ○ │ b7458ffedb08 a1 - │ ├─╯ - ○ │ b27346e9a9bd c1 - │ │ @ 0cdd923e993a d2 - │ │ ○ 0f21c5e185c5 d1 - ├───╯ - │ │ ○ 7b44470918f4 b2 - │ │ ○ dcc98bc8bbea b1 - ├───╯ - │ │ ○ 196bc1f0efc1 a4 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 61237f8ed16f c2 + │ ├─┬─╮ + │ │ │ ○ 7366036f148d b1 + │ │ ○ │ b7458ffedb08 a1 + │ │ ├─╯ + │ ○ │ b27346e9a9bd c1 + ├─╯ │ + │ ○ │ 7b44470918f4 b2 + │ ○ │ dcc98bc8bbea b1 + ├─╯ │ + │ ○ │ 196bc1f0efc1 a4 │ ├─╯ │ ○ 17072aa2b823 a3 │ ○ 47df67757a64 a2 │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship between @@ -2133,26 +2133,26 @@ fn test_duplicate_insert_after_before() { Duplicated 196bc1f0efc1 as prukwozq 96798f1b a4 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 267f3c6f05a2 c2 - ├─╮ - │ ○ 96798f1b59fc a4 - │ ○ d4d3c9073a3b a3 - ○ │ b27346e9a9bd c1 - │ │ @ 0cdd923e993a d2 - │ │ ○ 0f21c5e185c5 d1 - ├───╯ - │ │ ○ 7b44470918f4 b2 - │ │ ○ dcc98bc8bbea b1 - ├───╯ - │ │ ○ 196bc1f0efc1 a4 - │ │ ○ 17072aa2b823 a3 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ 267f3c6f05a2 c2 + │ ├─╮ + │ │ ○ 96798f1b59fc a4 + │ │ ○ d4d3c9073a3b a3 + │ ○ │ b27346e9a9bd c1 + ├─╯ │ + │ ○ │ 7b44470918f4 b2 + │ ○ │ dcc98bc8bbea b1 + ├─╯ │ + │ ○ │ 196bc1f0efc1 a4 + │ ○ │ 17072aa2b823 a3 │ ├─╯ │ ○ 47df67757a64 a2 │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship between a commit @@ -2168,25 +2168,25 @@ fn test_duplicate_insert_after_before() { Duplicated 47df67757a64 as yvrnrpnw 72eb571c a2 Rebased 2 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ b5ab4b26d9a2 a4 - ○ 64f9306ab0d0 a3 - ├─╮ - │ ○ 72eb571caee0 a2 - │ ○ 940b51398e5d a1 - │ ○ 09560d60cac4 c2 - │ ○ b27346e9a9bd c1 - ○ │ 47df67757a64 a2 - ○ │ 9e85a474f005 a1 - ├─╯ - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 + │ ○ b5ab4b26d9a2 a4 + │ ○ 64f9306ab0d0 a3 + │ ├─╮ + │ │ ○ 72eb571caee0 a2 + │ │ ○ 940b51398e5d a1 + │ │ ○ 09560d60cac4 c2 + │ │ ○ b27346e9a9bd c1 + ├───╯ + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship between descendant @@ -2203,24 +2203,24 @@ fn test_duplicate_insert_after_before() { Duplicated 196bc1f0efc1 as rxnrppxl 53c4e5dd a4 Rebased 3 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 7668841ec9b9 a4 - ○ 223fd997dec0 a3 - ○ 9750bf965aff a2 - ○ 53c4e5ddca56 a4 - ○ 54dec05c42f1 a3 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 7668841ec9b9 a4 + │ ○ 223fd997dec0 a3 + │ ○ 9750bf965aff a2 + │ ○ 53c4e5ddca56 a4 + │ ○ 54dec05c42f1 a3 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship between ancestor @@ -2237,24 +2237,24 @@ fn test_duplicate_insert_after_before() { Duplicated 47df67757a64 as nqtyztop a80a88f5 a2 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ d1f47b881c72 a4 - ○ a80a88f5c6d6 a2 - ○ 08e917fe904c a1 - ○ 17072aa2b823 a3 - ○ 47df67757a64 a2 - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ d1f47b881c72 a4 + │ ○ a80a88f5c6d6 a2 + │ ○ 08e917fe904c a1 + │ ○ 17072aa2b823 a3 + │ ○ 47df67757a64 a2 + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits with an ancestry relationship between an ancestor @@ -2269,26 +2269,26 @@ fn test_duplicate_insert_after_before() { Duplicated 17072aa2b823 as uwrrnrtx 3ce18231 a3 Rebased 1 commits onto duplicated commits "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" - ○ 0855137fa398 a4 - ├─╮ - │ ○ 3ce182317a5b a3 - │ ○ 8517eaa73536 a2 - ○ │ 17072aa2b823 a3 - ○ │ 47df67757a64 a2 - ├─╯ - ○ 9e85a474f005 a1 - │ @ 0cdd923e993a d2 - │ ○ 0f21c5e185c5 d1 - ├─╯ + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" + @ 0cdd923e993a d2 + ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 │ ○ b27346e9a9bd c1 ├─╯ │ ○ 7b44470918f4 b2 │ ○ dcc98bc8bbea b1 ├─╯ + │ ○ 0855137fa398 a4 + │ ├─╮ + │ │ ○ 3ce182317a5b a3 + │ │ ○ 8517eaa73536 a2 + │ ○ │ 17072aa2b823 a3 + │ ○ │ 47df67757a64 a2 + │ ├─╯ + │ ○ 9e85a474f005 a1 + ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Should error if a loop will be created. @@ -2319,12 +2319,12 @@ fn test_undo_after_duplicate() { insta::assert_snapshot!(stderr, @r###" Duplicated 2443ea76b0b1 as mzvwutvl f5cefcbb a "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ f5cefcbb65a4 a - │ @ 2443ea76b0b1 a + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 2443ea76b0b1 a + │ ○ f5cefcbb65a4 a ├─╯ ◆ 000000000000 - "###); + "#); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["undo"]); insta::assert_snapshot!(stdout, @""); @@ -2365,16 +2365,16 @@ fn test_rebase_duplicates() { insta::assert_snapshot!(stderr, @r###" Duplicated 7e4fbf4f2759 as znkkpsqq ce5f4eeb c "###); - insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r###" - ○ ce5f4eeb69d1 c @ 2001-02-03 04:05:16.000 +07:00 - │ ○ 0ac2063b1bee c @ 2001-02-03 04:05:15.000 +07:00 + insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r#" + @ 7e4fbf4f2759 c @ 2001-02-03 04:05:13.000 +07:00 + │ ○ ce5f4eeb69d1 c @ 2001-02-03 04:05:16.000 +07:00 ├─╯ - │ @ 7e4fbf4f2759 c @ 2001-02-03 04:05:13.000 +07:00 + │ ○ 0ac2063b1bee c @ 2001-02-03 04:05:15.000 +07:00 ├─╯ ○ 1394f625cbbd b @ 2001-02-03 04:05:11.000 +07:00 ○ 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00 ◆ 000000000000 @ 1970-01-01 00:00:00.000 +00:00 - "###); + "#); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-s", "b", "-d", "root()"]); insta::assert_snapshot!(stdout, @""); @@ -2386,17 +2386,17 @@ fn test_rebase_duplicates() { "#); // Some of the duplicate commits' timestamps were changed a little to make them // have distinct commit ids. - insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r###" - ○ b86e9f27d085 c @ 2001-02-03 04:05:16.000 +07:00 - │ ○ 8033590fe04d c @ 2001-02-03 04:05:17.000 +07:00 + insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r#" + @ ed671a3cbf35 c @ 2001-02-03 04:05:18.000 +07:00 + │ ○ b86e9f27d085 c @ 2001-02-03 04:05:16.000 +07:00 ├─╯ - │ @ ed671a3cbf35 c @ 2001-02-03 04:05:18.000 +07:00 + │ ○ 8033590fe04d c @ 2001-02-03 04:05:17.000 +07:00 ├─╯ ○ 4c6f1569e2a9 b @ 2001-02-03 04:05:18.000 +07:00 │ ○ 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00 ├─╯ ◆ 000000000000 @ 1970-01-01 00:00:00.000 +00:00 - "###); + "#); } fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String { diff --git a/cli/tests/test_git_colocated.rs b/cli/tests/test_git_colocated.rs index a8c94c282..6ac7447d4 100644 --- a/cli/tests/test_git_colocated.rs +++ b/cli/tests/test_git_colocated.rs @@ -554,8 +554,8 @@ fn test_git_colocated_fetch_deleted_or_moved_bookmark() { // "original C" and "B_to_delete" are abandoned, as the corresponding bookmarks // were deleted or moved on the remote (#864) insta::assert_snapshot!(get_log_output(&test_env, &clone_path), @r#" - ○ 4f3d13296f978cbc351c46a43b4619c91b888475 C_to_move moved C - │ @ 9c2de797c3c299a40173c5af724329012b77cbdd + @ 9c2de797c3c299a40173c5af724329012b77cbdd + │ ○ 4f3d13296f978cbc351c46a43b4619c91b888475 C_to_move moved C ├─╯ ◆ a7e4cec4256b7995129b9d1e1bda7e1df6e60678 A git_head() A ◆ 0000000000000000000000000000000000000000 diff --git a/cli/tests/test_git_fetch.rs b/cli/tests/test_git_fetch.rs index 19bb76d1f..e6c2f96ac 100644 --- a/cli/tests/test_git_fetch.rs +++ b/cli/tests/test_git_fetch.rs @@ -482,17 +482,17 @@ fn test_git_fetch_all() { trunk1: zowqyktl ff36dc55 descr_for_trunk1 @origin: zowqyktl ff36dc55 descr_for_trunk1 "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - │ ○ decaa3966c83 descr_for_a2 a2 - ├─╯ - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ │ ○ decaa3966c83 descr_for_a2 a2 + │ ├─╯ + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "###); + "#); // ==== Change both repos ==== // First, change the target repo: @@ -515,17 +515,17 @@ fn test_git_fetch_all() { ); // Our repo before and after fetch - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ 061eddbb43ab new_descr_for_b_to_create_conflict b* - │ ○ decaa3966c83 descr_for_a2 a2 - ├─╯ - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ 061eddbb43ab new_descr_for_b_to_create_conflict b* + │ │ ○ decaa3966c83 descr_for_a2 a2 + │ ├─╯ + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "###); + "#); insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" a1: nknoxmzm 359a9a02 descr_for_a1 @origin: nknoxmzm 359a9a02 descr_for_a1 @@ -560,20 +560,20 @@ fn test_git_fetch_all() { trunk2: umznmzko 8f1f14fb descr_for_trunk2 @origin: umznmzko 8f1f14fb descr_for_trunk2 "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ babc49226c14 descr_for_b b?? b@origin - │ ○ 91e46b4b2653 descr_for_a2 a2 - ├─╯ - │ ○ 0424f6dfc1ff descr_for_a1 a1 - ├─╯ - ○ 8f1f14fbbf42 descr_for_trunk2 trunk2 - │ ○ 061eddbb43ab new_descr_for_b_to_create_conflict b?? - ├─╯ - ○ ff36dc55760e descr_for_trunk1 trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ babc49226c14 descr_for_b b?? b@origin + │ │ ○ 91e46b4b2653 descr_for_a2 a2 + │ ├─╯ + │ │ ○ 0424f6dfc1ff descr_for_a1 a1 + │ ├─╯ + │ ○ 8f1f14fbbf42 descr_for_trunk2 trunk2 + │ │ ○ 061eddbb43ab new_descr_for_b_to_create_conflict b?? + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "###); + "#); } #[test] @@ -633,13 +633,13 @@ fn test_git_fetch_some_of_many_bookmarks() { insta::assert_snapshot!(stderr, @r###" bookmark: b@origin [new] tracked "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); // ...check what the intermediate state looks like... insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" b: vpupmnsl c7d4bdcb descr_for_b @@ -655,17 +655,17 @@ fn test_git_fetch_some_of_many_bookmarks() { bookmark: a1@origin [new] tracked bookmark: a2@origin [new] tracked "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ decaa3966c83 descr_for_a2 a2 - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - │ ○ c7d4bdcbc215 descr_for_b b - ├─╯ - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ decaa3966c83 descr_for_a2 a2 + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ │ ○ c7d4bdcbc215 descr_for_b b + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); // Fetching the same bookmark again let (stdout, stderr) = test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch", "--branch", "a1"]); @@ -673,17 +673,17 @@ fn test_git_fetch_some_of_many_bookmarks() { insta::assert_snapshot!(stderr, @r###" Nothing changed. "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ decaa3966c83 descr_for_a2 a2 - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - │ ○ c7d4bdcbc215 descr_for_b b - ├─╯ - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ decaa3966c83 descr_for_a2 a2 + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ │ ○ c7d4bdcbc215 descr_for_b b + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); // ==== Change both repos ==== // First, change the target repo: @@ -706,17 +706,17 @@ fn test_git_fetch_some_of_many_bookmarks() { ); // Our repo before and after fetch of two bookmarks - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ 6ebd41dc4f13 new_descr_for_b_to_create_conflict b* - │ ○ decaa3966c83 descr_for_a2 a2 - ├─╯ - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ 6ebd41dc4f13 new_descr_for_b_to_create_conflict b* + │ │ ○ decaa3966c83 descr_for_a2 a2 + │ ├─╯ + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); let (stdout, stderr) = test_env.jj_cmd_ok( &target_jj_repo_path, &["git", "fetch", "--branch", "b", "--branch", "a1"], @@ -727,20 +727,20 @@ fn test_git_fetch_some_of_many_bookmarks() { bookmark: b@origin [updated] tracked Abandoned 1 commits that are no longer reachable. "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ 01d115196c39 descr_for_b b?? b@origin - │ ○ 6df2d34cf0da descr_for_a1 a1 - ├─╯ - ○ 2bb3ebd2bba3 descr_for_trunk2 - │ ○ 6ebd41dc4f13 new_descr_for_b_to_create_conflict b?? - ├─╯ - │ ○ decaa3966c83 descr_for_a2 a2 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ 01d115196c39 descr_for_b b?? b@origin + │ │ ○ 6df2d34cf0da descr_for_a1 a1 + │ ├─╯ + │ ○ 2bb3ebd2bba3 descr_for_trunk2 + │ │ ○ 6ebd41dc4f13 new_descr_for_b_to_create_conflict b?? + │ ├─╯ + │ │ ○ decaa3966c83 descr_for_a2 a2 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); // We left a2 where it was before, let's see how `jj bookmark list` sees this. insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" @@ -765,20 +765,20 @@ fn test_git_fetch_some_of_many_bookmarks() { bookmark: a2@origin [updated] tracked Abandoned 1 commits that are no longer reachable. "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ 31c7d94b1f29 descr_for_a2 a2 - │ ○ 01d115196c39 descr_for_b b?? b@origin - ├─╯ - │ ○ 6df2d34cf0da descr_for_a1 a1 - ├─╯ - ○ 2bb3ebd2bba3 descr_for_trunk2 - │ ○ 6ebd41dc4f13 new_descr_for_b_to_create_conflict b?? - ├─╯ - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ 31c7d94b1f29 descr_for_a2 a2 + │ │ ○ 01d115196c39 descr_for_b b?? b@origin + │ ├─╯ + │ │ ○ 6df2d34cf0da descr_for_a1 a1 + │ ├─╯ + │ ○ 2bb3ebd2bba3 descr_for_trunk2 + │ │ ○ 6ebd41dc4f13 new_descr_for_b_to_create_conflict b?? + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" a1: ypowunwp 6df2d34c descr_for_a1 @origin: ypowunwp 6df2d34c descr_for_a1 @@ -920,15 +920,15 @@ fn test_git_fetch_undo() { bookmark: a1@origin [new] tracked bookmark: b@origin [new] tracked "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); let (stdout, stderr) = test_env.jj_cmd_ok(&target_jj_repo_path, &["undo"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r#" @@ -946,13 +946,13 @@ fn test_git_fetch_undo() { insta::assert_snapshot!(stderr, @r###" bookmark: b@origin [new] tracked "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); } // Compare to `test_git_import_undo` in test_git_import_export @@ -998,13 +998,13 @@ fn test_fetch_undo_what() { insta::assert_snapshot!(stderr, @r###" bookmark: b@origin [new] tracked "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" b: vpupmnsl c7d4bdcb descr_for_b @origin: vpupmnsl c7d4bdcb descr_for_b @@ -1178,17 +1178,17 @@ fn test_git_fetch_removed_bookmark() { bookmark: b@origin [new] tracked bookmark: trunk1@origin [new] tracked "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - │ ○ decaa3966c83 descr_for_a2 a2 - ├─╯ - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ │ ○ decaa3966c83 descr_for_a2 a2 + │ ├─╯ + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "###); + "#); // Remove a2 bookmark in origin test_env.jj_cmd_ok(&source_git_repo_path, &["bookmark", "forget", "a2"]); @@ -1200,17 +1200,17 @@ fn test_git_fetch_removed_bookmark() { insta::assert_snapshot!(stderr, @r###" Nothing changed. "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - │ ○ decaa3966c83 descr_for_a2 a2 - ├─╯ - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ │ ○ decaa3966c83 descr_for_a2 a2 + │ ├─╯ + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "###); + "#); // Fetch bookmarks a2 from origin, and check that it has been removed locally let (stdout, stderr) = @@ -1220,15 +1220,15 @@ fn test_git_fetch_removed_bookmark() { bookmark: a2@origin [deleted] untracked Abandoned 1 commits that are no longer reachable. "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "###); + "#); } #[test] @@ -1270,17 +1270,17 @@ fn test_git_fetch_removed_parent_bookmark() { bookmark: b@origin [new] tracked bookmark: trunk1@origin [new] tracked "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - │ ○ decaa3966c83 descr_for_a2 a2 - ├─╯ - │ ○ 359a9a02457d descr_for_a1 a1 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ │ ○ decaa3966c83 descr_for_a2 a2 + │ ├─╯ + │ │ ○ 359a9a02457d descr_for_a1 a1 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "###); + "#); // Remove all bookmarks in origin. test_env.jj_cmd_ok(&source_git_repo_path, &["bookmark", "forget", "glob:*"]); @@ -1301,15 +1301,15 @@ fn test_git_fetch_removed_parent_bookmark() { Abandoned 1 commits that are no longer reachable. Warning: No branch matching `master` found on any specified/configured remote "###); - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" - ○ c7d4bdcbc215 descr_for_b b - │ ○ decaa3966c83 descr_for_a2 a2 - ├─╯ - ○ ff36dc55760e descr_for_trunk1 - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + @ 230dd059e1b0 + │ ○ c7d4bdcbc215 descr_for_b b + │ │ ○ decaa3966c83 descr_for_a2 a2 + │ ├─╯ + │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "###); + "#); } #[test] @@ -1368,12 +1368,12 @@ fn test_git_fetch_remote_only_bookmark() { // Fetch using git.auto_local_bookmark = false test_env.add_config("git.auto-local-bookmark = false"); test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ◆ 9f01a0e04879 message feature1 feature2@origin - │ @ 230dd059e1b0 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ 230dd059e1b0 + │ ◆ 9f01a0e04879 message feature1 feature2@origin ├─╯ ◆ 000000000000 - "###); + "#); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" feature1: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 5adac498a..9e83cdd12 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -1151,15 +1151,15 @@ fn test_git_push_deleted() { Delete bookmark bookmark1 from d13ecdbda2a2 "#); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-rall()"]); - insta::assert_snapshot!(stdout, @r###" - ○ rlzusymt test.user@example.com 2001-02-03 08:05:10 bookmark2 8476341e - │ (empty) description 2 + insta::assert_snapshot!(stdout, @r#" + @ yqosqzyt test.user@example.com 2001-02-03 08:05:13 5b36783c + │ (empty) (no description set) + │ ○ rlzusymt test.user@example.com 2001-02-03 08:05:10 bookmark2 8476341e + ├─╯ (empty) description 2 │ ○ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 d13ecdbd ├─╯ (empty) description 1 - │ @ yqosqzyt test.user@example.com 2001-02-03 08:05:13 5b36783c - ├─╯ (empty) (no description set) ◆ zzzzzzzz root() 00000000 - "###); + "#); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--deleted"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r###" diff --git a/cli/tests/test_log_command.rs b/cli/tests/test_log_command.rs index be53a850f..3bf63a9cc 100644 --- a/cli/tests/test_log_command.rs +++ b/cli/tests/test_log_command.rs @@ -776,12 +776,12 @@ fn test_log_divergence() { &["describe", "-m", "description 2", "--at-operation", "@-"], ); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "-T", template]); - insta::assert_snapshot!(stdout, @r###" - ○ description 2 !divergence! - │ @ description 1 !divergence! + insta::assert_snapshot!(stdout, @r#" + @ description 1 !divergence! + │ ○ description 2 !divergence! ├─╯ ◆ - "###); + "#); insta::assert_snapshot!(stderr, @r###" Concurrent modification detected, resolving automatically. "###); diff --git a/cli/tests/test_next_prev_commands.rs b/cli/tests/test_next_prev_commands.rs index 5c6555ea1..78aa0e88b 100644 --- a/cli/tests/test_next_prev_commands.rs +++ b/cli/tests/test_next_prev_commands.rs @@ -1125,17 +1125,17 @@ fn test_next_offset_when_wc_has_descendants() { test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "left-2"]); test_env.jj_cmd_ok(&repo_path, &["edit", "description(right-wc)"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ vruxwmqvtpmx left-2 - ○ yqosqzytrlsw left-1 - ○ royxmykxtrkr left-wc - │ ○ zsuskulnrvyr right-2 - │ ○ kkmpptxzrspx right-1 - │ @ rlvkpnrzqnoo right-wc + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + ○ zsuskulnrvyr right-2 + ○ kkmpptxzrspx right-1 + @ rlvkpnrzqnoo right-wc + │ ○ vruxwmqvtpmx left-2 + │ ○ yqosqzytrlsw left-1 + │ ○ royxmykxtrkr left-wc ├─╯ ○ qpvuntsmwlqt base ◆ zzzzzzzzzzzz - "###); + "#); test_env.jj_cmd_ok(&repo_path, &["next", "2"]); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" diff --git a/cli/tests/test_operations.rs b/cli/tests/test_operations.rs index 75117daf1..f9fe67d6f 100644 --- a/cli/tests/test_operations.rs +++ b/cli/tests/test_operations.rs @@ -769,10 +769,10 @@ fn test_op_recover_from_bad_gc() { // The repo should no longer be corrupt. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log"]); insta::assert_snapshot!(stdout, @r#" - ○ mzvwutvl?? test.user@example.com 2001-02-03 08:05:15 dc2c6d52 - │ (empty) 4.1 - │ @ mzvwutvl?? test.user@example.com 2001-02-03 08:05:12 6d868f04 - ├─╯ (empty) 4 + @ mzvwutvl?? test.user@example.com 2001-02-03 08:05:12 6d868f04 + │ (empty) 4 + │ ○ mzvwutvl?? test.user@example.com 2001-02-03 08:05:15 dc2c6d52 + ├─╯ (empty) 4.1 ○ zsuskuln test.user@example.com 2001-02-03 08:05:10 git_head() f652c321 │ (empty) (no description set) ◆ zzzzzzzz root() 00000000 diff --git a/cli/tests/test_parallelize_command.rs b/cli/tests/test_parallelize_command.rs index 8928437b7..4f4cf0885 100644 --- a/cli/tests/test_parallelize_command.rs +++ b/cli/tests/test_parallelize_command.rs @@ -435,13 +435,13 @@ fn test_parallelize_multiple_heads_with_and_without_children() { &workspace_path, &["parallelize", "description(0)", "description(1)"], ); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###" - ○ 6270540ee067 1 parents: - │ @ 97d7522f40e8 2 parents: 0 - │ ○ 745bea8029c1 0 parents: + insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r#" + @ 97d7522f40e8 2 parents: 0 + ○ 745bea8029c1 0 parents: + │ ○ 6270540ee067 1 parents: ├─╯ ◆ 000000000000 parents: - "###); + "#); } #[test] diff --git a/cli/tests/test_rebase_command.rs b/cli/tests/test_rebase_command.rs index fbe5033e3..14ee9ee5e 100644 --- a/cli/tests/test_rebase_command.rs +++ b/cli/tests/test_rebase_command.rs @@ -561,12 +561,12 @@ fn test_rebase_multiple_revisions() { Parent commit : kmkuslsw d1bfda8c f | f Added 0 files, modified 0 files, removed 2 files "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ h: g - ○ g: f - │ ○ e: d - │ ○ d: i - │ @ i: f + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + ○ e: d + ○ d: i + @ i: f + │ ○ h: g + │ ○ g: f ├─╯ ○ f: c a ├─╮ @@ -575,7 +575,7 @@ fn test_rebase_multiple_revisions() { ├─╯ ○ a ◆ - "###); + "#); } #[test] @@ -837,7 +837,7 @@ fn test_rebase_with_descendants() { Parent commit : rlvkpnrz 2443ea76 a | a Added 0 files, modified 0 files, removed 2 files "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" @ d: a │ ○ c: a b ╭─┤ @@ -845,7 +845,7 @@ fn test_rebase_with_descendants() { ├─╯ ○ a ◆ - "###); + "#); // Same test as above, but with multiple commits per argument test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -865,7 +865,7 @@ fn test_rebase_with_descendants() { Parent commit : rlvkpnrz 2443ea76 a | a Added 0 files, modified 0 files, removed 2 files "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" @ d: a │ ○ c: a b ╭─┤ @@ -873,7 +873,7 @@ fn test_rebase_with_descendants() { ├─╯ ○ a ◆ - "###); + "#); } #[test] @@ -1539,23 +1539,23 @@ fn test_rebase_after() { Parent commit : nkmrtpmo 0d7e4ce9 e | e Added 0 files, modified 0 files, removed 3 files "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ d: b1 b3 + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + ○ c: b2 b4 ├─╮ - │ │ ○ c: b2 b4 - │ │ ├─╮ - │ │ │ ○ b4: f - │ │ ○ │ b2: f - │ │ ├─╯ - │ │ @ f: e - │ │ ○ e: b1 b3 + │ ○ b4: f + ○ │ b2: f + ├─╯ + @ f: e + ○ e: b1 b3 + ├─╮ + │ │ ○ d: b1 b3 ╭─┬─╯ │ ○ b3: a ○ │ b1: a ├─╯ ○ a ◆ - "###); + "#); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Rebase a subgraph with four commits after one of the commits itself. diff --git a/cli/tests/test_squash_command.rs b/cli/tests/test_squash_command.rs index 4e30fbdf2..ec401ddac 100644 --- a/cli/tests/test_squash_command.rs +++ b/cli/tests/test_squash_command.rs @@ -607,14 +607,14 @@ fn test_squash_from_to_partial() { insta::assert_snapshot!(stderr, @r###" Rebased 1 descendant commits "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" - ○ d2a587ae205d c - ○ a53394306362 b - │ @ e0dac715116f d + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + @ e0dac715116f d + │ ○ d2a587ae205d c + │ ○ a53394306362 b ├─╯ ○ b7b767179c44 a ◆ 000000000000 (empty) - "###); + "#); // The selected change from the source has been applied let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]); insta::assert_snapshot!(stdout, @r###" diff --git a/cli/tests/test_workspaces.rs b/cli/tests/test_workspaces.rs index 5c49fce68..b3edfb2b8 100644 --- a/cli/tests/test_workspaces.rs +++ b/cli/tests/test_workspaces.rs @@ -48,13 +48,13 @@ fn test_workspaces_add_second_workspace() { // Can see the working-copy commit in each workspace in the log output. The "@" // node in the graph indicates the current workspace's working-copy commit. - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 5ed2222c28e2 second@ - │ @ 8183d0fcaa4c default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 8183d0fcaa4c default@ + │ ○ 5ed2222c28e2 second@ ├─╯ ○ 751b12b7b981 ◆ 000000000000 - "###); + "); insta::assert_snapshot!(get_log_output(&test_env, &secondary_path), @r###" @ 5ed2222c28e2 second@ │ ○ 8183d0fcaa4c default@ @@ -145,16 +145,16 @@ fn test_workspaces_add_second_workspace_on_merge() { ); // The new workspace's working-copy commit shares all parents with the old one. - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 7013a493bd09 second@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 35e47bff781e default@ ├─╮ - │ │ @ 35e47bff781e default@ + │ │ ○ 7013a493bd09 second@ ╭─┬─╯ │ ○ 444b77e99d43 ○ │ 1694f2ddf8ec ├─╯ ◆ 000000000000 - "###); + "); } /// Test that --ignore-working-copy is respected @@ -282,14 +282,14 @@ fn test_workspaces_add_workspace_at_revision() { // Can see the working-copy commit in each workspace in the log output. The "@" // node in the graph indicates the current workspace's working-copy commit. - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ e374e74aa0c8 second@ - │ @ dadeedb493e8 default@ - │ ○ c420244c6398 + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ dadeedb493e8 default@ + ○ c420244c6398 + │ ○ e374e74aa0c8 second@ ├─╯ ○ f6097c2f7cac ◆ 000000000000 - "###); + "); insta::assert_snapshot!(get_log_output(&test_env, &secondary_path), @r###" @ e374e74aa0c8 second@ │ ○ dadeedb493e8 default@ @@ -352,18 +352,18 @@ fn test_workspaces_add_workspace_multiple_revisions() { Added 3 files, modified 0 files, removed 0 files "###); - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ f4fa64f40944 merge@ - ├─┬─╮ - │ │ ○ f6097c2f7cac - │ ○ │ 544cd61f2d26 - │ ├─╯ - ○ │ 6c843d62ca29 - ├─╯ - │ @ 5b36783cd11c default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 5b36783cd11c default@ + │ ○ f4fa64f40944 merge@ + │ ├─┬─╮ + │ │ │ ○ f6097c2f7cac + ├─────╯ + │ │ ○ 544cd61f2d26 + ├───╯ + │ ○ 6c843d62ca29 ├─╯ ◆ 000000000000 - "###); + "); } #[test] @@ -471,13 +471,13 @@ fn test_workspaces_conflicting_edits() { test_env.jj_cmd_ok(&main_path, &["workspace", "add", "../secondary"]); - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 3224de8ae048 secondary@ - │ @ 06b57f44a3ca default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 06b57f44a3ca default@ + │ ○ 3224de8ae048 secondary@ ├─╯ ○ 506f4ec3c2c6 ◆ 000000000000 - "###); + "); // Make changes in both working copies std::fs::write(main_path.join("file"), "changed in main\n").unwrap(); @@ -526,27 +526,27 @@ fn test_workspaces_conflicting_edits() { Updated working copy to fresh commit e82cd4ee8faa "###); insta::assert_snapshot!(get_log_output(&test_env, &secondary_path), - @r###" - × a28c85ce128b (divergent) - │ ○ a58c9a9b19ce default@ + @r" + @ e82cd4ee8faa secondary@ (divergent) + │ × a28c85ce128b (divergent) ├─╯ - │ @ e82cd4ee8faa secondary@ (divergent) + │ ○ a58c9a9b19ce default@ ├─╯ ○ d41244767d45 ◆ 000000000000 - "###); + "); // The stale working copy should have been resolved by the previous command let stdout = get_log_output(&test_env, &secondary_path); assert!(!stdout.starts_with("The working copy is stale")); - insta::assert_snapshot!(stdout, @r###" - × a28c85ce128b (divergent) - │ ○ a58c9a9b19ce default@ + insta::assert_snapshot!(stdout, @r" + @ e82cd4ee8faa secondary@ (divergent) + │ × a28c85ce128b (divergent) ├─╯ - │ @ e82cd4ee8faa secondary@ (divergent) + │ ○ a58c9a9b19ce default@ ├─╯ ○ d41244767d45 ◆ 000000000000 - "###); + "); } /// Test a clean working copy that gets rewritten from another workspace @@ -562,13 +562,13 @@ fn test_workspaces_updated_by_other() { test_env.jj_cmd_ok(&main_path, &["workspace", "add", "../secondary"]); - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 3224de8ae048 secondary@ - │ @ 06b57f44a3ca default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 06b57f44a3ca default@ + │ ○ 3224de8ae048 secondary@ ├─╯ ○ 506f4ec3c2c6 ◆ 000000000000 - "###); + "); // Rewrite the check-out commit in one workspace. std::fs::write(main_path.join("file"), "changed in main\n").unwrap(); @@ -604,13 +604,13 @@ fn test_workspaces_updated_by_other() { Updated working copy to fresh commit e82cd4ee8faa "###); insta::assert_snapshot!(get_log_output(&test_env, &secondary_path), - @r###" - ○ a58c9a9b19ce default@ - │ @ e82cd4ee8faa secondary@ + @r" + @ e82cd4ee8faa secondary@ + │ ○ a58c9a9b19ce default@ ├─╯ ○ d41244767d45 ◆ 000000000000 - "###); + "); } /// Test a clean working copy that gets rewritten from another workspace @@ -628,13 +628,13 @@ fn test_workspaces_updated_by_other_automatic() { test_env.jj_cmd_ok(&main_path, &["workspace", "add", "../secondary"]); - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 3224de8ae048 secondary@ - │ @ 06b57f44a3ca default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 06b57f44a3ca default@ + │ ○ 3224de8ae048 secondary@ ├─╯ ○ 506f4ec3c2c6 ◆ 000000000000 - "###); + "); // Rewrite the check-out commit in one workspace. std::fs::write(main_path.join("file"), "changed in main\n").unwrap(); @@ -669,13 +669,13 @@ fn test_workspaces_updated_by_other_automatic() { "###); insta::assert_snapshot!(get_log_output(&test_env, &secondary_path), - @r###" - ○ a58c9a9b19ce default@ - │ @ e82cd4ee8faa secondary@ + @r" + @ e82cd4ee8faa secondary@ + │ ○ a58c9a9b19ce default@ ├─╯ ○ d41244767d45 ◆ 000000000000 - "###); + "); } #[test_case(false; "manual")] @@ -750,13 +750,13 @@ fn test_workspaces_current_op_discarded_by_other(automatic: bool) { test_env.jj_cmd_ok(&main_path, &["util", "gc", "--expire=now"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 96b31dafdc41 secondary@ - │ @ 6c051bd1ccd5 default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 6c051bd1ccd5 default@ + │ ○ 96b31dafdc41 secondary@ ├─╯ ○ 7c5b25a4fc8f ◆ 000000000000 - "###); + "); } if automatic { @@ -793,14 +793,14 @@ fn test_workspaces_current_op_discarded_by_other(automatic: bool) { } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 15df8cb57d3f secondary@ - ○ 96b31dafdc41 - │ @ 6c051bd1ccd5 default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 6c051bd1ccd5 default@ + │ ○ 15df8cb57d3f secondary@ + │ ○ 96b31dafdc41 ├─╯ ○ 7c5b25a4fc8f ◆ 000000000000 - "###); + "); } // The sparse patterns should remain @@ -1037,12 +1037,12 @@ fn test_workspaces_forget_abandon_commits() { second: uuqppmxq 57d63245 (empty) (no description set) third: uuqppmxq 57d63245 (empty) (no description set) "###); - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 57d63245a308 fourth@ second@ third@ - │ @ 4e8f9d2be039 default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 4e8f9d2be039 default@ + │ ○ 57d63245a308 fourth@ second@ third@ ├─╯ ◆ 000000000000 - "###); + "); // delete the default workspace (should not abandon commit since not empty) test_env.jj_cmd_success(&main_path, &["workspace", "forget", "default"]); @@ -1247,12 +1247,12 @@ fn test_workspaces_rename_workspace() { "###); // Can see the working-copy commit in each workspace in the log output. - insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r###" - ○ 57d63245a308 third@ - │ @ 230dd059e1b0 default@ + insta::assert_snapshot!(get_log_output(&test_env, &main_path), @r" + @ 230dd059e1b0 default@ + │ ○ 57d63245a308 third@ ├─╯ ◆ 000000000000 - "###); + "); insta::assert_snapshot!(get_log_output(&test_env, &secondary_path), @r###" @ 57d63245a308 third@ │ ○ 230dd059e1b0 default@ diff --git a/lib/src/graph.rs b/lib/src/graph.rs index 49219c63e..09450a3fe 100644 --- a/lib/src/graph.rs +++ b/lib/src/graph.rs @@ -121,9 +121,10 @@ impl Iterator for ReverseGraphIterator { /// branches will be visited. At merge point, the second (or the last) ancestor /// branch will be visited first. This is practically [the same as Git][Git]. /// -/// The branch containing the first commit in the input iterator will be emitted -/// first. It is often the working-copy ancestor branch. The other head branches -/// won't be enqueued eagerly, and will be emitted as late as possible. +/// If no branches are prioritized, the branch containing the first commit in +/// the input iterator will be emitted first. It is often the working-copy +/// ancestor branch. The other head branches won't be enqueued eagerly, and will +/// be emitted as late as possible. /// /// [Git]: https://github.blog/2022-08-30-gits-database-internals-ii-commit-history-queries/#topological-sorting #[derive(Clone, Debug)] @@ -133,7 +134,8 @@ pub struct TopoGroupedGraphIterator { nodes: HashMap>, /// Stack of graph nodes to be emitted. emittable_ids: Vec, - /// List of new head nodes found while processing unpopulated nodes. + /// List of new head nodes found while processing unpopulated nodes, or + /// prioritized branch nodes added by caller. new_head_ids: VecDeque, /// Set of nodes which may be ancestors of `new_head_ids`. blocked_ids: HashSet, @@ -173,6 +175,22 @@ where } } + /// Makes the branch containing the specified node be emitted earlier than + /// the others. + /// + /// The `id` usually points to a head node, but this isn't a requirement. + /// If the specified node isn't a head, all preceding nodes will be queued. + /// + /// The specified node must exist in the input iterator. If it didn't, the + /// iterator would panic. + pub fn prioritize_branch(&mut self, id: N) { + // Mark existence of unpopulated node + self.nodes.entry(id.clone()).or_default(); + // Push to non-emitting list so the prioritized heads wouldn't be + // interleaved + self.new_head_ids.push_back(id); + } + fn populate_one(&mut self) -> Result, E> { let (current_id, edges) = match self.input_iter.next() { Some(Ok(data)) => data, @@ -278,7 +296,8 @@ where } let Some(edges) = current_node.edges.take() else { // Not yet populated - self.populate_one()?.expect("parent node should exist"); + self.populate_one()? + .expect("parent or prioritized node should exist"); continue; }; // The second (or the last) parent will be visited first @@ -1532,6 +1551,296 @@ mod tests { "###); } + #[test] + fn test_topo_grouped_prioritized_branches_trivial_fork() { + // The same setup as test_topo_grouped_trivial_fork() + let graph = [ + ('E', vec![direct('B')]), + ('D', vec![direct('A')]), + ('C', vec![direct('B')]), + ('B', vec![direct('A')]), + ('A', vec![]), + ] + .map(Ok); + insta::assert_snapshot!(format_graph(graph.iter().cloned()), @r" + E direct(B) + │ + │ D direct(A) + │ │ + │ │ C direct(B) + ├───╯ + B │ direct(A) + ├─╯ + A + "); + + // Emit the branch C first + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('C'); + insta::assert_snapshot!(format_graph(iter), @r" + C direct(B) + │ + │ E direct(B) + ├─╯ + B direct(A) + │ + │ D direct(A) + ├─╯ + A + "); + + // Emit the branch D first + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('D'); + insta::assert_snapshot!(format_graph(iter), @r" + D direct(A) + │ + │ E direct(B) + │ │ + │ │ C direct(B) + │ ├─╯ + │ B direct(A) + ├─╯ + A + "); + + // Emit the branch C first, then D. E is emitted earlier than D because + // E belongs to the branch C compared to the branch D. + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('C'); + iter.prioritize_branch('D'); + insta::assert_snapshot!(format_graph(iter), @r" + C direct(B) + │ + │ E direct(B) + ├─╯ + B direct(A) + │ + │ D direct(A) + ├─╯ + A + "); + + // Non-head node can be prioritized + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('B'); + insta::assert_snapshot!(format_graph(iter), @r" + E direct(B) + │ + │ C direct(B) + ├─╯ + B direct(A) + │ + │ D direct(A) + ├─╯ + A + "); + + // Root node can be prioritized + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('A'); + insta::assert_snapshot!(format_graph(iter), @r" + D direct(A) + │ + │ E direct(B) + │ │ + │ │ C direct(B) + │ ├─╯ + │ B direct(A) + ├─╯ + A + "); + } + + #[test] + fn test_topo_grouped_prioritized_branches_fork_multiple_heads() { + // The same setup as test_topo_grouped_fork_multiple_heads() + let graph = [ + ('I', vec![direct('E')]), + ('H', vec![direct('C')]), + ('G', vec![direct('A')]), + ('F', vec![direct('E')]), + ('E', vec![direct('C')]), + ('D', vec![direct('C')]), + ('C', vec![direct('A')]), + ('B', vec![direct('A')]), + ('A', vec![]), + ] + .map(Ok); + insta::assert_snapshot!(format_graph(graph.iter().cloned()), @r" + I direct(E) + │ + │ H direct(C) + │ │ + │ │ G direct(A) + │ │ │ + │ │ │ F direct(E) + ├─────╯ + E │ │ direct(C) + ├─╯ │ + │ D │ direct(C) + ├─╯ │ + C │ direct(A) + ├───╯ + │ B direct(A) + ├─╯ + A + "); + + // Emit B, G, then remainders + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('B'); + iter.prioritize_branch('G'); + insta::assert_snapshot!(format_graph(iter), @r" + B direct(A) + │ + │ G direct(A) + ├─╯ + │ I direct(E) + │ │ + │ │ F direct(E) + │ ├─╯ + │ E direct(C) + │ │ + │ │ H direct(C) + │ ├─╯ + │ │ D direct(C) + │ ├─╯ + │ C direct(A) + ├─╯ + A + "); + + // Emit D, H, then descendants of C. The order of B and G is not + // respected because G can be found earlier through C->A->G. At this + // point, B is not populated yet, so A is blocked only by {G}. This is + // a limitation of the current node reordering logic. + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('D'); + iter.prioritize_branch('H'); + iter.prioritize_branch('B'); + iter.prioritize_branch('G'); + insta::assert_snapshot!(format_graph(iter), @r" + D direct(C) + │ + │ H direct(C) + ├─╯ + │ I direct(E) + │ │ + │ │ F direct(E) + │ ├─╯ + │ E direct(C) + ├─╯ + C direct(A) + │ + │ G direct(A) + ├─╯ + │ B direct(A) + ├─╯ + A + "); + } + + #[test] + fn test_topo_grouped_prioritized_branches_fork_parallel() { + // The same setup as test_topo_grouped_fork_parallel() + let graph = [ + // Pull all sub graphs in reverse order: + ('I', vec![direct('A')]), + ('H', vec![direct('C')]), + ('G', vec![direct('E')]), + // Orphan sub graph G,F-E: + ('F', vec![direct('E')]), + ('E', vec![missing('Y')]), + // Orphan sub graph H,D-C: + ('D', vec![direct('C')]), + ('C', vec![missing('X')]), + // Orphan sub graph I,B-A: + ('B', vec![direct('A')]), + ('A', vec![]), + ] + .map(Ok); + insta::assert_snapshot!(format_graph(graph.iter().cloned()), @r" + I direct(A) + │ + │ H direct(C) + │ │ + │ │ G direct(E) + │ │ │ + │ │ │ F direct(E) + │ │ ├─╯ + │ │ E missing(Y) + │ │ │ + │ │ ~ + │ │ + │ │ D direct(C) + │ ├─╯ + │ C missing(X) + │ │ + │ ~ + │ + │ B direct(A) + ├─╯ + A + "); + + // Emit the sub graph G first + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('G'); + insta::assert_snapshot!(format_graph(iter), @r" + G direct(E) + │ + │ F direct(E) + ├─╯ + E missing(Y) + │ + ~ + + I direct(A) + │ + │ B direct(A) + ├─╯ + A + + H direct(C) + │ + │ D direct(C) + ├─╯ + C missing(X) + │ + ~ + "); + + // Emit sub graphs in reverse order by selecting roots + let mut iter = topo_grouped(graph.iter().cloned()); + iter.prioritize_branch('E'); + iter.prioritize_branch('C'); + iter.prioritize_branch('A'); + insta::assert_snapshot!(format_graph(iter), @r" + G direct(E) + │ + │ F direct(E) + ├─╯ + E missing(Y) + │ + ~ + + H direct(C) + │ + │ D direct(C) + ├─╯ + C missing(X) + │ + ~ + + I direct(A) + │ + │ B direct(A) + ├─╯ + A + "); + } + #[test] fn test_topo_grouped_requeue_unpopulated() { let graph = [