tests: migrate snapshot users of jj_cmd_success() to run_jj_in()

These callers were mostly substituted mechanically, then fixed up minor
formatting and name errors.
This commit is contained in:
Yuya Nishihara 2025-02-22 23:13:04 +09:00
parent 317993894b
commit cdcc777730
52 changed files with 1681 additions and 1712 deletions

View File

@ -381,7 +381,7 @@ fn test_double_abandon() {
create_commit(&test_env, &repo_path, "a", &[]); create_commit(&test_env, &repo_path, "a", &[]);
// Test the setup // Test the setup
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r", "a"]), @r" test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r", "a"]), @r"
rlvkpnrz test.user@example.com 2001-02-03 08:05:09 a 2443ea76 rlvkpnrz test.user@example.com 2001-02-03 08:05:09 a 2443ea76
a a
[EOF] [EOF]
@ -438,8 +438,8 @@ fn test_abandon_restore_descendants() {
Parent commit : qpvuntsm 485d52a9 (no description set) Parent commit : qpvuntsm 485d52a9 (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file b/file diff --git a/file b/file
index 257cc5642c..76018072e0 100644 index 257cc5642c..76018072e0 100644
--- a/file --- a/file

View File

@ -40,8 +40,8 @@ fn test_diff() {
SecretBackend::adopt_git_repo(&repo_path); SecretBackend::adopt_git_repo(&repo_path);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--color-words"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--color-words"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
Modified regular file a-first: Modified regular file a-first:
1 1: foobar 1 1: foobar
Access denied to added-secret: No access Access denied to added-secret: No access
@ -52,8 +52,8 @@ fn test_diff() {
1 1: foobar 1 1: foobar
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--summary"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
M a-first M a-first
C {a-first => added-secret} C {a-first => added-secret}
D deleted-secret D deleted-secret
@ -62,8 +62,8 @@ fn test_diff() {
M z-last M z-last
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--types"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--types"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
FF a-first FF a-first
FF {a-first => added-secret} FF {a-first => added-secret}
F- deleted-secret F- deleted-secret
@ -72,8 +72,8 @@ fn test_diff() {
FF z-last FF z-last
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
a-first | 2 +- a-first | 2 +-
{a-first => added-secret} | 2 +- {a-first => added-secret} | 2 +-
deleted-secret | 1 - deleted-secret | 1 -

View File

@ -27,8 +27,8 @@ fn test_alias_basic() {
&repo_path, &repo_path,
&["bookmark", "create", "my-bookmark", "-r", "@"], &["bookmark", "create", "my-bookmark", "-r", "@"],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["bk"]); let output = test_env.run_jj_in(&repo_path, ["bk"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ my-bookmark @ my-bookmark
~ ~
@ -215,33 +215,33 @@ fn test_alias_global_args_before_and_after() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
test_env.add_config(r#"aliases.l = ["log", "-T", "commit_id", "-r", "all()"]"#); test_env.add_config(r#"aliases.l = ["log", "-T", "commit_id", "-r", "all()"]"#);
// Test the setup // Test the setup
let stdout = test_env.jj_cmd_success(&repo_path, &["l"]); let output = test_env.run_jj_in(&repo_path, ["l"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22
0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
[EOF] [EOF]
"); ");
// Can pass global args before // Can pass global args before
let stdout = test_env.jj_cmd_success(&repo_path, &["l", "--at-op", "@-"]); let output = test_env.run_jj_in(&repo_path, ["l", "--at-op", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
[EOF] [EOF]
"); ");
// Can pass global args after // Can pass global args after
let stdout = test_env.jj_cmd_success(&repo_path, &["--at-op", "@-", "l"]); let output = test_env.run_jj_in(&repo_path, ["--at-op", "@-", "l"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
[EOF] [EOF]
"); ");
// Test passing global args both before and after // Test passing global args both before and after
let stdout = test_env.jj_cmd_success(&repo_path, &["--at-op", "abc123", "l", "--at-op", "@-"]); let output = test_env.run_jj_in(&repo_path, ["--at-op", "abc123", "l", "--at-op", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["-R", "../nonexistent", "l", "-R", "."]); let output = test_env.run_jj_in(&repo_path, ["-R", "../nonexistent", "l", "-R", "."]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22
0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
[EOF] [EOF]
@ -258,8 +258,8 @@ fn test_alias_global_args_in_definition() {
); );
// The global argument in the alias is respected // The global argument in the alias is respected
let stdout = test_env.jj_cmd_success(&repo_path, &["l"]); let output = test_env.run_jj_in(&repo_path, ["l"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
 0000000000000000000000000000000000000000  0000000000000000000000000000000000000000
[EOF] [EOF]
"); ");
@ -317,15 +317,15 @@ fn test_alias_in_repo_config() {
.unwrap(); .unwrap();
// In repo1 sub directory, aliases can be loaded from the repo1 config. // In repo1 sub directory, aliases can be loaded from the repo1 config.
let stdout = test_env.jj_cmd_success(&repo1_path.join("sub"), &["l"]); let output = test_env.run_jj_in(&repo1_path.join("sub"), ["l"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
repo1 alias repo1 alias
[EOF] [EOF]
"); ");
// In repo2 directory, no repo-local aliases exist. // In repo2 directory, no repo-local aliases exist.
let stdout = test_env.jj_cmd_success(&repo2_path, &["l"]); let output = test_env.run_jj_in(&repo2_path, ["l"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
user alias user alias
[EOF] [EOF]
"); ");
@ -368,9 +368,9 @@ fn test_alias_in_repo_config() {
// Config loaded from the cwd-relative workspace shouldn't persist. It's // Config loaded from the cwd-relative workspace shouldn't persist. It's
// used only for command arguments expansion. // used only for command arguments expansion.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo1_path, &repo1_path,
&[ [
"config", "config",
"list", "list",
"aliases", "aliases",
@ -378,7 +378,7 @@ fn test_alias_in_repo_config() {
repo2_path.to_str().unwrap(), repo2_path.to_str().unwrap(),
], ],
); );
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
aliases.l = ['log', '-r@', '--no-graph', '-T"user alias\n"'] aliases.l = ['log', '-r@', '--no-graph', '-T"user alias\n"']
[EOF] [EOF]
"#); "#);

View File

@ -56,8 +56,8 @@ fn test_backout() {
000000000000 000000000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A a A a
[EOF] [EOF]
"); ");
@ -74,8 +74,8 @@ fn test_backout() {
000000000000 000000000000
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@+"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@+"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D a D a
[EOF] [EOF]
"); ");
@ -96,8 +96,8 @@ fn test_backout() {
000000000000 000000000000
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@+"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@+"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A a A a
[EOF] [EOF]
"); ");
@ -156,8 +156,8 @@ fn test_backout_multiple() {
[EOF] [EOF]
"#); "#);
// View the output of each backed out commit // View the output of each backed out commit
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "@+"]); let output = test_env.run_jj_in(&repo_path, ["show", "@+"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
Commit ID: 8ff3fbc2ccb0d66985f558c461d1643cebb4c7d6 Commit ID: 8ff3fbc2ccb0d66985f558c461d1643cebb4c7d6
Change ID: wqnwkozpkustnxypnnntnykwrqrkrpvv Change ID: wqnwkozpkustnxypnnntnykwrqrkrpvv
Author : Test User <test.user@example.com> (2001-02-03 08:05:19) Author : Test User <test.user@example.com> (2001-02-03 08:05:19)
@ -173,8 +173,8 @@ fn test_backout_multiple() {
3 : c 3 : c
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "@++"]); let output = test_env.run_jj_in(&repo_path, ["show", "@++"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
Commit ID: d31d42e0267f6524d445348b1dd00926c62a6b57 Commit ID: d31d42e0267f6524d445348b1dd00926c62a6b57
Change ID: mouksmquosnpvwqrpsvvxtxpywpnxlss Change ID: mouksmquosnpvwqrpsvvxtxpywpnxlss
Author : Test User <test.user@example.com> (2001-02-03 08:05:19) Author : Test User <test.user@example.com> (2001-02-03 08:05:19)
@ -188,8 +188,8 @@ fn test_backout_multiple() {
1 : b 1 : b
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "@+++"]); let output = test_env.run_jj_in(&repo_path, ["show", "@+++"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
Commit ID: 6504c4ded177fba2334f76683d1aa643700d5073 Commit ID: 6504c4ded177fba2334f76683d1aa643700d5073
Change ID: tqvpomtpwrqsylrpsxknultrymmqxmxv Change ID: tqvpomtpwrqsylrpsxknultrymmqxmxv
Author : Test User <test.user@example.com> (2001-02-03 08:05:19) Author : Test User <test.user@example.com> (2001-02-03 08:05:19)
@ -231,8 +231,8 @@ fn test_backout_description_template() {
000000000000 000000000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A a A a
[EOF] [EOF]
"); ");

View File

@ -1683,9 +1683,9 @@ fn test_bookmark_list_filtered() {
let template = r#"separate(" ", commit_id.short(), bookmarks, if(hidden, "(hidden)"))"#; let template = r#"separate(" ", commit_id.short(), bookmarks, if(hidden, "(hidden)"))"#;
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success( test_env.run_jj_in(
&local_path, &local_path,
&["log", "-r::(bookmarks() | remote_bookmarks())", "-T", template], ["log", "-r::(bookmarks() | remote_bookmarks())", "-T", template],
), ),
@r" @r"
@ c7b4c09cd77c local-keep @ c7b4c09cd77c local-keep
@ -2154,7 +2154,7 @@ fn test_bookmark_list_conflicted() {
+ kkmpptxz 06a973bc (empty) b + kkmpptxz 06a973bc (empty) b
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["bookmark", "list", "--conflicted"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["bookmark", "list", "--conflicted"]), @r"
foo (conflicted): foo (conflicted):
+ rlvkpnrz d8d5f980 (empty) a + rlvkpnrz d8d5f980 (empty) a
+ kkmpptxz 06a973bc (empty) b + kkmpptxz 06a973bc (empty) b

View File

@ -53,8 +53,8 @@ fn set_up(trunk_name: &str) -> (TestEnvironment, PathBuf) {
fn test_builtin_alias_trunk_matches_main() { fn test_builtin_alias_trunk_matches_main() {
let (test_env, workspace_root) = set_up("main"); let (test_env, workspace_root) = set_up("main");
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd
(empty) description 1 (empty) description 1
~ ~
@ -66,8 +66,8 @@ fn test_builtin_alias_trunk_matches_main() {
fn test_builtin_alias_trunk_matches_master() { fn test_builtin_alias_trunk_matches_master() {
let (test_env, workspace_root) = set_up("master"); let (test_env, workspace_root) = set_up("master");
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 master d13ecdbd xtvrqkyv test.user@example.com 2001-02-03 08:05:08 master d13ecdbd
(empty) description 1 (empty) description 1
~ ~
@ -79,8 +79,8 @@ fn test_builtin_alias_trunk_matches_master() {
fn test_builtin_alias_trunk_matches_trunk() { fn test_builtin_alias_trunk_matches_trunk() {
let (test_env, workspace_root) = set_up("trunk"); let (test_env, workspace_root) = set_up("trunk");
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 trunk d13ecdbd xtvrqkyv test.user@example.com 2001-02-03 08:05:08 trunk d13ecdbd
(empty) description 1 (empty) description 1
~ ~
@ -95,8 +95,8 @@ fn test_builtin_alias_trunk_matches_exactly_one_commit() {
test_env.jj_cmd_ok(&origin_path, &["new", "root()", "-m=description 3"]); test_env.jj_cmd_ok(&origin_path, &["new", "root()", "-m=description 3"]);
test_env.jj_cmd_ok(&origin_path, &["bookmark", "create", "-r@", "master"]); test_env.jj_cmd_ok(&origin_path, &["bookmark", "create", "-r@", "master"]);
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd
(empty) description 1 (empty) description 1
~ ~
@ -112,8 +112,8 @@ fn test_builtin_alias_trunk_override_alias() {
r#"revset-aliases.'trunk()' = 'latest(remote_bookmarks(exact:"override-trunk", exact:"origin"))'"#, r#"revset-aliases.'trunk()' = 'latest(remote_bookmarks(exact:"override-trunk", exact:"origin"))'"#,
); );
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 override-trunk d13ecdbd xtvrqkyv test.user@example.com 2001-02-03 08:05:08 override-trunk d13ecdbd
(empty) description 1 (empty) description 1
~ ~

View File

@ -154,8 +154,8 @@ fn test_commit_interactive() {
JJ: Lines starting with "JJ:" (like this one) will be removed. JJ: Lines starting with "JJ:" (like this one) will be removed.
"###); "###);
let stdout = test_env.jj_cmd_success(&workspace_path, &["log", "--summary"]); let output = test_env.run_jj_in(&workspace_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ mzvwutvl test.user@example.com 2001-02-03 08:05:11 21b846a6 @ mzvwutvl test.user@example.com 2001-02-03 08:05:11 21b846a6
(no description set) (no description set)
A file2 A file2
@ -210,8 +210,8 @@ fn test_commit_interactive_with_paths() {
JJ: Lines starting with "JJ:" (like this one) will be removed. JJ: Lines starting with "JJ:" (like this one) will be removed.
"#); "#);
let stdout = test_env.jj_cmd_success(&workspace_path, &["log", "--summary"]); let output = test_env.run_jj_in(&workspace_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ kkmpptxz test.user@example.com 2001-02-03 08:05:09 f3e6062e @ kkmpptxz test.user@example.com 2001-02-03 08:05:09 f3e6062e
(no description set) (no description set)
M file2 M file2
@ -366,15 +366,15 @@ fn test_commit_paths() {
std::fs::write(workspace_path.join("file2"), "bar\n").unwrap(); std::fs::write(workspace_path.join("file2"), "bar\n").unwrap();
test_env.jj_cmd_ok(&workspace_path, &["commit", "-m=first", "file1"]); test_env.jj_cmd_ok(&workspace_path, &["commit", "-m=first", "file1"]);
let stdout = test_env.jj_cmd_success(&workspace_path, &["diff", "-r", "@-"]); let output = test_env.run_jj_in(&workspace_path, ["diff", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Added regular file file1: Added regular file file1:
1: foo 1: foo
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&workspace_path, &["diff"]); let output = test_env.run_jj_in(&workspace_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Added regular file file2: Added regular file file2:
1: bar 1: bar
[EOF] [EOF]
@ -399,8 +399,8 @@ fn test_commit_paths_warning() {
"); ");
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&workspace_path, &["diff"]); let output = test_env.run_jj_in(&workspace_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Added regular file file1: Added regular file file1:
1: foo 1: foo
Added regular file file2: Added regular file file2:

View File

@ -30,8 +30,8 @@ fn test_log_parents() {
let template = let template =
r#"commit_id ++ "\nP: " ++ parents.len() ++ " " ++ parents.map(|c| c.commit_id()) ++ "\n""#; r#"commit_id ++ "\nP: " ++ parents.len() ++ " " ++ parents.map(|c| c.commit_id()) ++ "\n""#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ c067170d4ca1bc6162b64f7550617ec809647f84 @ c067170d4ca1bc6162b64f7550617ec809647f84
P: 2 4db490c88528133d579540b6900b8098f0c17701 230dd059e1b059aefc0da06a2e5a7dbf22362f22 P: 2 4db490c88528133d579540b6900b8098f0c17701 230dd059e1b059aefc0da06a2e5a7dbf22362f22
4db490c88528133d579540b6900b8098f0c17701 4db490c88528133d579540b6900b8098f0c17701
@ -46,8 +46,8 @@ fn test_log_parents() {
// List<Commit> can be filtered // List<Commit> can be filtered
let template = let template =
r#""P: " ++ parents.filter(|c| !c.root()).map(|c| c.commit_id().short()) ++ "\n""#; r#""P: " ++ parents.filter(|c| !c.root()).map(|c| c.commit_id().short()) ++ "\n""#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ P: 4db490c88528 230dd059e1b0 @ P: 4db490c88528 230dd059e1b0
P: 230dd059e1b0 P: 230dd059e1b0
@ -58,11 +58,8 @@ fn test_log_parents() {
"); ");
let template = r#"parents.map(|c| c.commit_id().shortest(4))"#; let template = r#"parents.map(|c| c.commit_id().shortest(4))"#;
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(&repo_path, ["log", "-T", template, "-r@", "--color=always"]);
&repo_path, insta::assert_snapshot!(output, @r"
&["log", "-T", template, "-r@", "--color=always"],
);
insta::assert_snapshot!(stdout, @r"
@ 4db4 230d @ 4db4 230d
~ ~
@ -110,8 +107,8 @@ fn test_log_author_timestamp() {
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "first"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "first"]);
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp()"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 2001-02-03 04:05:09.000 +07:00 @ 2001-02-03 04:05:09.000 +07:00
2001-02-03 04:05:08.000 +07:00 2001-02-03 04:05:08.000 +07:00
1970-01-01 00:00:00.000 +00:00 1970-01-01 00:00:00.000 +00:00
@ -145,8 +142,8 @@ fn test_log_author_timestamp_utc() {
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().utc()"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp().utc()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 2001-02-02 21:05:07.000 +00:00 @ 2001-02-02 21:05:07.000 +00:00
1970-01-01 00:00:00.000 +00:00 1970-01-01 00:00:00.000 +00:00
[EOF] [EOF]
@ -161,15 +158,15 @@ fn test_log_author_timestamp_local() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
test_env.add_env_var("TZ", "UTC-05:30"); test_env.add_env_var("TZ", "UTC-05:30");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().local()"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp().local()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 2001-02-03 08:05:07.000 +11:00 @ 2001-02-03 08:05:07.000 +11:00
1970-01-01 11:00:00.000 +11:00 1970-01-01 11:00:00.000 +11:00
[EOF] [EOF]
"); ");
test_env.add_env_var("TZ", "UTC+10:00"); test_env.add_env_var("TZ", "UTC+10:00");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().local()"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp().local()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 2001-02-03 08:05:07.000 +11:00 @ 2001-02-03 08:05:07.000 +11:00
1970-01-01 11:00:00.000 +11:00 1970-01-01 11:00:00.000 +11:00
[EOF] [EOF]
@ -192,8 +189,8 @@ fn test_log_author_timestamp_after_before() {
if(author.timestamp().before("1975"), "(before 1975)", "(after 1975)"), if(author.timestamp().before("1975"), "(before 1975)", "(after 1975)"),
if(author.timestamp().before("now"), "(before now)", "(after now)") if(author.timestamp().before("now"), "(before now)", "(after now)")
) ++ "\n""#; ) ++ "\n""#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
2001-02-03 04:05:08.000 +07:00 : (after 1969) (after 1975) (before now) 2001-02-03 04:05:08.000 +07:00 : (after 1969) (after 1975) (before now)
1970-01-01 00:00:00.000 +00:00 : (after 1969) (before 1975) (before now) 1970-01-01 00:00:00.000 +00:00 : (after 1969) (before 1975) (before now)
[EOF] [EOF]
@ -232,15 +229,15 @@ fn test_mine_is_true_when_author_is_user() {
], ],
); );
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-T", "-T",
r#"coalesce(if(mine, "mine"), author.email(), email_placeholder)"#, r#"coalesce(if(mine, "mine"), author.email(), email_placeholder)"#,
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ johndoe@example.com @ johndoe@example.com
mine mine
(no email set) (no email set)
@ -260,8 +257,8 @@ fn test_log_default() {
test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "my-bookmark"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "my-bookmark"]);
// Test default log output format // Test default log output format
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]); let output = test_env.run_jj_in(&repo_path, ["log"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e @ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e
(empty) description 1 (empty) description 1
qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7 qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7
@ -271,8 +268,8 @@ fn test_log_default() {
"); ");
// Color // Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]); let output = test_env.run_jj_in(&repo_path, ["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e @ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e
(empty) description 1 (empty) description 1
qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7 qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7
@ -282,8 +279,8 @@ fn test_log_default() {
"); ");
// Color without graph // Color without graph
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always", "--no-graph"]); let output = test_env.run_jj_in(&repo_path, ["log", "--color=always", "--no-graph"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e
(empty) description 1 (empty) description 1
qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7 qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7
@ -300,8 +297,8 @@ fn test_log_default_without_working_copy() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_ok(&repo_path, &["workspace", "forget"]); test_env.jj_cmd_ok(&repo_path, &["workspace", "forget"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]); let output = test_env.run_jj_in(&repo_path, ["log"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
zzzzzzzz root() 00000000 zzzzzzzz root() 00000000
[EOF] [EOF]
"); ");
@ -522,9 +519,9 @@ fn test_log_evolog_divergence() {
std::fs::write(repo_path.join("file"), "foo\n").unwrap(); std::fs::write(repo_path.join("file"), "foo\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 1"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 1"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
// No divergence // No divergence
insta::assert_snapshot!(stdout, @r" let output = test_env.run_jj_in(&repo_path, ["log"]);
insta::assert_snapshot!(output, @r"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:08 ff309c29 @ qpvuntsm test.user@example.com 2001-02-03 08:05:08 ff309c29
description 1 description 1
zzzzzzzz root() 00000000 zzzzzzzz root() 00000000
@ -551,8 +548,8 @@ fn test_log_evolog_divergence() {
"); ");
// Color // Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]); let output = test_env.run_jj_in(&repo_path, ["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29
description 1 description 1
qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00 qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00
@ -562,8 +559,8 @@ fn test_log_evolog_divergence() {
"); ");
// Evolog and hidden divergent // Evolog and hidden divergent
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog"]); let output = test_env.run_jj_in(&repo_path, ["evolog"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29
description 1 description 1
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 485d52a9 qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 485d52a9
@ -574,8 +571,8 @@ fn test_log_evolog_divergence() {
"); ");
// Colored evolog // Colored evolog
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--color=always"]); let output = test_env.run_jj_in(&repo_path, ["evolog", "--color=always"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29
description 1 description 1
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 485d52a9 qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 485d52a9
@ -640,7 +637,7 @@ fn test_log_bookmarks() {
test_env.jj_cmd_ok(&workspace_root, &["git", "fetch"]); test_env.jj_cmd_ok(&workspace_root, &["git", "fetch"]);
let template = r#"commit_id.short() ++ " " ++ if(bookmarks, bookmarks, "(no bookmarks)")"#; let template = r#"commit_id.short() ++ " " ++ if(bookmarks, bookmarks, "(no bookmarks)")"#;
let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); let output = test_env.run_jj_in(&workspace_root, ["log", "-T", template]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
@ a5b4d15489cc bookmark2* new-bookmark @ a5b4d15489cc bookmark2* new-bookmark
8476341eb395 bookmark2@origin unchanged 8476341eb395 bookmark2@origin unchanged
@ -655,7 +652,7 @@ fn test_log_bookmarks() {
"); ");
let template = r#"bookmarks.map(|b| separate("/", b.remote(), b.name())).join(", ")"#; let template = r#"bookmarks.map(|b| separate("/", b.remote(), b.name())).join(", ")"#;
let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); let output = test_env.run_jj_in(&workspace_root, ["log", "-T", template]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
@ bookmark2, new-bookmark @ bookmark2, new-bookmark
origin/bookmark2, unchanged origin/bookmark2, unchanged
@ -670,7 +667,7 @@ fn test_log_bookmarks() {
"); ");
let template = r#"separate(" ", "L:", local_bookmarks, "R:", remote_bookmarks)"#; let template = r#"separate(" ", "L:", local_bookmarks, "R:", remote_bookmarks)"#;
let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); let output = test_env.run_jj_in(&workspace_root, ["log", "-T", template]);
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
@ L: bookmark2* new-bookmark R: @ L: bookmark2* new-bookmark R:
L: unchanged R: bookmark2@origin unchanged@origin L: unchanged R: bookmark2@origin unchanged@origin
@ -692,9 +689,9 @@ fn test_log_bookmarks() {
++ "/-" ++ ref.tracking_behind_count().lower() ++ ")"), ++ "/-" ++ ref.tracking_behind_count().lower() ++ ")"),
)) ))
"#; "#;
let output = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&workspace_root, &workspace_root,
&["log", "-r::remote_bookmarks()", "-T", template], ["log", "-r::remote_bookmarks()", "-T", template],
); );
insta::assert_snapshot!(output, @r" insta::assert_snapshot!(output, @r"
bookmark3@origin(+0/-1) bookmark3@origin(+0/-1)
@ -717,16 +714,16 @@ fn test_log_git_head() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m=initial"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m=initial"]);
std::fs::write(repo_path.join("file"), "foo\n").unwrap(); std::fs::write(repo_path.join("file"), "foo\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "git_head"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "git_head"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ false @ false
true true
false false
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]); let output = test_env.run_jj_in(&repo_path, ["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 50aaf475 @ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 50aaf475
initial initial
qpvuntsm test.user@example.com 2001-02-03 08:05:07 git_head() 230dd059 qpvuntsm test.user@example.com 2001-02-03 08:05:07 git_head() 230dd059
@ -745,15 +742,15 @@ fn test_log_commit_id_normal_hex() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "first"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "first"]);
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-T", "-T",
r#"commit_id ++ ": " ++ commit_id.normal_hex()"#, r#"commit_id ++ ": " ++ commit_id.normal_hex()"#,
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 6572f22267c6f0f2bf7b8a37969ee5a7d54b8aae: 6572f22267c6f0f2bf7b8a37969ee5a7d54b8aae @ 6572f22267c6f0f2bf7b8a37969ee5a7d54b8aae: 6572f22267c6f0f2bf7b8a37969ee5a7d54b8aae
222fa9f0b41347630a1371203b8aad3897d34e5f: 222fa9f0b41347630a1371203b8aad3897d34e5f 222fa9f0b41347630a1371203b8aad3897d34e5f: 222fa9f0b41347630a1371203b8aad3897d34e5f
230dd059e1b059aefc0da06a2e5a7dbf22362f22: 230dd059e1b059aefc0da06a2e5a7dbf22362f22 230dd059e1b059aefc0da06a2e5a7dbf22362f22: 230dd059e1b059aefc0da06a2e5a7dbf22362f22
@ -771,15 +768,15 @@ fn test_log_change_id_normal_hex() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "first"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "first"]);
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-T", "-T",
r#"change_id ++ ": " ++ change_id.normal_hex()"#, r#"change_id ++ ": " ++ change_id.normal_hex()"#,
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ kkmpptxzrspxrzommnulwmwkkqwworpl: ffdaa62087a280bddc5e3d3ff933b8ae @ kkmpptxzrspxrzommnulwmwkkqwworpl: ffdaa62087a280bddc5e3d3ff933b8ae
rlvkpnrzqnoowoytxnquwvuryrwnrmlp: 8e4fac809cbb3b162c953458183c8dea rlvkpnrzqnoowoytxnquwvuryrwnrmlp: 8e4fac809cbb3b162c953458183c8dea
qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu: 9a45c67d3e96a7e5007c110ede34dec5 qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu: 9a45c67d3e96a7e5007c110ede34dec5
@ -798,15 +795,15 @@ fn test_log_customize_short_id() {
// Customize both the commit and the change id // Customize both the commit and the change id
let decl = "template-aliases.'format_short_id(id)'"; let decl = "template-aliases.'format_short_id(id)'";
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"--config", "--config",
&format!(r#"{decl}='id.shortest(5).prefix().upper() ++ "_" ++ id.shortest(5).rest()'"#), &format!(r#"{decl}='id.shortest(5).prefix().upper() ++ "_" ++ id.shortest(5).rest()'"#),
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ Q_pvun test.user@example.com 2001-02-03 08:05:08 F_a156 @ Q_pvun test.user@example.com 2001-02-03 08:05:08 F_a156
(empty) first (empty) first
Z_zzzz root() 0_0000 Z_zzzz root() 0_0000
@ -814,14 +811,14 @@ fn test_log_customize_short_id() {
"); ");
// Customize only the change id // Customize only the change id
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"--config=template-aliases.'format_short_change_id(id)'='format_short_id(id).upper()'", "--config=template-aliases.'format_short_change_id(id)'='format_short_id(id).upper()'",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ QPVUNTSM test.user@example.com 2001-02-03 08:05:08 fa15625b @ QPVUNTSM test.user@example.com 2001-02-03 08:05:08 fa15625b
(empty) first (empty) first
ZZZZZZZZ root() 00000000 ZZZZZZZZ root() 00000000
@ -849,8 +846,8 @@ fn test_log_immutable() {
"#; "#;
test_env.add_config("revset-aliases.'immutable_heads()' = 'main'"); test_env.add_config("revset-aliases.'immutable_heads()' = 'main'");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r::", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "-r::", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ D @ D
C C
B main [immutable] B main [immutable]
@ -920,16 +917,16 @@ fn test_log_contained_in() {
) )
}; };
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-r::", "-r::",
"-T", "-T",
&template_for_revset(r#"description(A)::"#), &template_for_revset(r#"description(A)::"#),
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ D @ D
C [contained_in] C [contained_in]
B main [contained_in] B main [contained_in]
@ -939,16 +936,16 @@ fn test_log_contained_in() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-r::", "-r::",
"-T", "-T",
&template_for_revset(r#"visible_heads()"#), &template_for_revset(r#"visible_heads()"#),
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ D [contained_in] @ D [contained_in]
C [contained_in] C [contained_in]
B main B main
@ -1075,8 +1072,8 @@ fn test_short_prefix_in_transaction() {
"); ");
// Should match log's short prefixes // Should match log's short prefixes
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph"]); let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
km[kuslswpqwq] 7[4ac55dd119b] test km[kuslswpqwq] 7[4ac55dd119b] test
y[qosqzytrlsw] 5[8731db5875e] commit4 y[qosqzytrlsw] 5[8731db5875e] commit4
r[oyxmykxtrkr] 9[95cc897bca7] commit3 r[oyxmykxtrkr] 9[95cc897bca7] commit3
@ -1090,8 +1087,8 @@ fn test_short_prefix_in_transaction() {
test_env.add_config(r#"revsets.short-prefixes = """#); test_env.add_config(r#"revsets.short-prefixes = """#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph"]); let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
kmk[uslswpqwq] 74ac[55dd119b] test kmk[uslswpqwq] 74ac[55dd119b] test
yq[osqzytrlsw] 587[31db5875e] commit4 yq[osqzytrlsw] 587[31db5875e] commit4
ro[yxmykxtrkr] 99[5cc897bca7] commit3 ro[yxmykxtrkr] 99[5cc897bca7] commit3
@ -1136,11 +1133,11 @@ fn test_log_diff_predefined_formats() {
"#; "#;
// color, without paths // color, without paths
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "--no-graph", "--color=always", "-r@", "-T", template], ["log", "--no-graph", "--color=always", "-r@", "-T", template],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== color_words === === color_words ===
Modified regular file file1: Modified regular file file1:
 1  1: a  1  1: a
@ -1183,11 +1180,11 @@ fn test_log_diff_predefined_formats() {
"); ");
// color labels // color labels
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "--no-graph", "--color=debug", "-r@", "-T", template], ["log", "--no-graph", "--color=debug", "-r@", "-T", template],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<log::=== color_words ===>> <<log::=== color_words ===>>
<<log diff color_words header::Modified regular file file1:>> <<log diff color_words header::Modified regular file file1:>>
<<log diff color_words removed line_number:: 1>><<log diff color_words:: >><<log diff color_words added line_number:: 1>><<log diff color_words::: a>> <<log diff color_words removed line_number:: 1>><<log diff color_words:: >><<log diff color_words added line_number:: 1>><<log diff color_words::: a>>
@ -1230,11 +1227,11 @@ fn test_log_diff_predefined_formats() {
"); ");
// cwd != workspace root // cwd != workspace root
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["log", "-Rrepo", "--no-graph", "-r@", "-T", template], ["log", "-Rrepo", "--no-graph", "-r@", "-T", template],
); );
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
=== color_words === === color_words ===
Modified regular file repo/file1: Modified regular file repo/file1:
1 1: a 1 1: a
@ -1286,9 +1283,9 @@ fn test_log_diff_predefined_formats() {
"}, "},
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"--config-file=../config-good.toml", "--config-file=../config-good.toml",
"--no-graph", "--no-graph",
@ -1297,7 +1294,7 @@ fn test_log_diff_predefined_formats() {
template, template,
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== color_words === === color_words ===
Modified regular file file1: Modified regular file file1:
... ...
@ -1372,8 +1369,8 @@ fn test_log_diff_predefined_formats() {
// color_words() with parameters // color_words() with parameters
let template = "self.diff('file1').color_words(0)"; let template = "self.diff('file1').color_words(0)";
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
... ...
3: c 3: c
@ -1382,8 +1379,8 @@ fn test_log_diff_predefined_formats() {
// git() with parameters // git() with parameters
let template = "self.diff('file1').git(1)"; let template = "self.diff('file1').git(1)";
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 422c2b7ab3..de980441c3 100644 index 422c2b7ab3..de980441c3 100644
--- a/file1 --- a/file1
@ -1410,8 +1407,8 @@ fn test_log_diff_predefined_formats() {
) ++ "\n", ) ++ "\n",
) )
"#}; "#};
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== fbad2dd53d06 === === fbad2dd53d06 ===
file1 [modified] source=file1 [file] target=file1 [file] file1 [modified] source=file1 [file] target=file1 [file]
file2 [modified] source=file2 [file] target=file2 [file] file2 [modified] source=file2 [file] target=file2 [file]
@ -1437,8 +1434,8 @@ fn test_log_diff_predefined_formats() {
) ++ "\n", ) ++ "\n",
) )
"#}; "#};
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== fbad2dd53d06 === === fbad2dd53d06 ===
* total_added=3 total_removed=1 * total_added=3 total_removed=1
=== 3c9b3178609b === === 3c9b3178609b ===
@ -1480,8 +1477,8 @@ fn test_file_list_entries() {
"executable=" ++ executable, "executable=" ++ executable,
) ++ "\n" ) ++ "\n"
"#}; "#};
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["file", "list", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
conflict-exec-file [conflict] conflict=true executable=true conflict-exec-file [conflict] conflict=true executable=true
conflict-file [conflict] conflict=true executable=false conflict-file [conflict] conflict=true executable=false
dir/file [file] conflict=false executable=false dir/file [file] conflict=false executable=false
@ -1500,8 +1497,8 @@ fn test_file_list_symlink() {
std::os::unix::fs::symlink("symlink_target", repo_path.join("symlink")).unwrap(); std::os::unix::fs::symlink("symlink_target", repo_path.join("symlink")).unwrap();
let template = r#"separate(" ", path, "[" ++ file_type ++ "]") ++ "\n""#; let template = r#"separate(" ", path, "[" ++ file_type ++ "]") ++ "\n""#;
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["file", "list", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
symlink [symlink] symlink [symlink]
[EOF] [EOF]
"); ");
@ -1525,16 +1522,16 @@ fn test_repo_path() {
"parent^2=" ++ if(path.parent().parent(), path.parent().parent(), "<none>"), "parent^2=" ++ if(path.parent().parent(), path.parent().parent(), "<none>"),
) ++ "\n" ) ++ "\n"
"#}; "#};
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["file", "list", "-T", template]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
dir/file display=dir/file parent=dir parent^2= dir/file display=dir/file parent=dir parent^2=
file display=file parent= parent^2=<none> file display=file parent= parent^2=<none>
[EOF] [EOF]
"); ");
let template = r#"separate(" ", path, "display=" ++ path.display()) ++ "\n""#; let template = r#"separate(" ", path, "display=" ++ path.display()) ++ "\n""#;
let stdout = test_env.jj_cmd_success(&repo_path.join("dir"), &["file", "list", "-T", template]); let output = test_env.run_jj_in(&repo_path.join("dir"), ["file", "list", "-T", template]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
dir/file display=file dir/file display=file
file display=../file file display=../file
[EOF] [EOF]
@ -1560,15 +1557,15 @@ fn test_signature_templates() {
) ++ " signature""#; ) ++ " signature""#;
// show that signatures can render // show that signatures can render
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ good test-display signature @ good test-display signature
no signature no signature
no signature no signature
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["show", "-T", template]);
insta::assert_snapshot!(stdout, @"good test-display signature[EOF]"); insta::assert_snapshot!(output, @"good test-display signature[EOF]");
// builtin templates // builtin templates
test_env.add_config("ui.show-cryptographic-signatures = true"); test_env.add_config("ui.show-cryptographic-signatures = true");

View File

@ -74,8 +74,8 @@ fn test_bookmark_names() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env; let test_env = test_env;
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "rename", ""]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "rename", ""]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
bbb-local x bbb-local x
@ -94,74 +94,74 @@ fn test_bookmark_names() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "rename", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "rename", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "delete", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "delete", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "forget", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "forget", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
aaa-untracked aaa-untracked
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["--", "jj", "bookmark", "list", "--bookmark", "a"], ["--", "jj", "bookmark", "list", "--bookmark", "a"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
aaa-untracked aaa-untracked
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "move", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "move", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "set", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "set", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "track", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "track", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-untracked@origin x aaa-untracked@origin x
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "untrack", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "untrack", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-tracked@origin x aaa-tracked@origin x
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "git", "push", "-b", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "git", "push", "-b", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "git", "fetch", "-b", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "git", "fetch", "-b", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa-local x aaa-local x
aaa-tracked x aaa-tracked x
aaa-untracked aaa-untracked
@ -181,9 +181,9 @@ fn test_global_arg_repository_is_respected() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env; let test_env = test_env;
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&[ [
"--", "--",
"jj", "jj",
"--repository", "--repository",
@ -193,7 +193,7 @@ fn test_global_arg_repository_is_respected() {
"a", "a",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa (no description set) aaa (no description set)
[EOF] [EOF]
"); ");
@ -219,14 +219,14 @@ fn test_aliases_are_resolved() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env; let test_env = test_env;
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "b", "rename", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "b", "rename", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa (no description set) aaa (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "b2", "rename", "a"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "b2", "rename", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
aaa (no description set) aaa (no description set)
[EOF] [EOF]
"); ");
@ -297,56 +297,56 @@ fn test_remote_names() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["--", "jj", "git", "remote", "remove", "o"], ["--", "jj", "git", "remote", "remove", "o"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
origin origin
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["--", "jj", "git", "remote", "rename", "o"], ["--", "jj", "git", "remote", "rename", "o"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
origin origin
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["--", "jj", "git", "remote", "set-url", "o"], ["--", "jj", "git", "remote", "set-url", "o"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
origin origin
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["--", "jj", "git", "push", "--remote", "o"], ["--", "jj", "git", "push", "--remote", "o"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
origin origin
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["--", "jj", "git", "fetch", "--remote", "o"], ["--", "jj", "git", "fetch", "--remote", "o"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
origin origin
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["--", "jj", "bookmark", "list", "--remote", "o"], ["--", "jj", "bookmark", "list", "--remote", "o"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
origin origin
[EOF] [EOF]
"); ");
@ -376,16 +376,16 @@ fn test_aliases_are_completed() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env; let test_env = test_env;
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "user-al"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "user-al"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
user-alias user-alias
[EOF] [EOF]
"); ");
// make sure --repository flag is respected // make sure --repository flag is respected
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&[ [
"--", "--",
"jj", "jj",
"--repository", "--repository",
@ -393,22 +393,22 @@ fn test_aliases_are_completed() {
"repo-al", "repo-al",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
repo-alias repo-alias
[EOF] [EOF]
"); ");
// cannot load aliases from --config flag // cannot load aliases from --config flag
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&[ [
"--", "--",
"jj", "jj",
"--config=aliases.cli-alias=['bookmark']", "--config=aliases.cli-alias=['bookmark']",
"cli-al", "cli-al",
], ],
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
} }
#[test] #[test]
@ -466,8 +466,8 @@ fn test_revisions() {
// completion function should be sufficient. // completion function should be sufficient.
// complete all revisions // complete all revisions
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "diff", "--from", ""]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "diff", "--from", ""]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
immutable_bookmark immutable immutable_bookmark immutable
mutable_bookmark mutable mutable_bookmark mutable
k working_copy k working_copy
@ -482,8 +482,8 @@ fn test_revisions() {
"); ");
// complete only mutable revisions // complete only mutable revisions
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "squash", "--into", ""]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "squash", "--into", ""]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
mutable_bookmark mutable mutable_bookmark mutable
k working_copy k working_copy
y mutable y mutable
@ -495,8 +495,8 @@ fn test_revisions() {
// complete args of the default command // complete args of the default command
test_env.add_config("ui.default-command = 'log'"); test_env.add_config("ui.default-command = 'log'");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "-r", ""]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "-r", ""]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
immutable_bookmark immutable immutable_bookmark immutable
mutable_bookmark mutable mutable_bookmark mutable
k working_copy k working_copy
@ -544,58 +544,58 @@ fn test_operations() {
.unwrap(); .unwrap();
insta::assert_snapshot!(add_workspace_id, @"eac759b9ab75"); insta::assert_snapshot!(add_workspace_id, @"eac759b9ab75");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "show", "5"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "show", "5"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710 5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
518b588abbc6 (2001-02-03 08:05:09) describe commit 19611c995a342c01f525583e5fcafdd211f6d009 518b588abbc6 (2001-02-03 08:05:09) describe commit 19611c995a342c01f525583e5fcafdd211f6d009
[EOF] [EOF]
"); ");
// make sure global --at-op flag is respected // make sure global --at-op flag is respected
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["--", "jj", "--at-op", "518b588abbc6", "op", "show", "5"], ["--", "jj", "--at-op", "518b588abbc6", "op", "show", "5"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
518b588abbc6 (2001-02-03 08:05:09) describe commit 19611c995a342c01f525583e5fcafdd211f6d009 518b588abbc6 (2001-02-03 08:05:09) describe commit 19611c995a342c01f525583e5fcafdd211f6d009
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "--at-op", "5b"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "--at-op", "5b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710 5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "abandon", "5b"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "abandon", "5b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710 5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "diff", "--op", "5b"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "diff", "--op", "5b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710 5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "diff", "--from", "5b"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "diff", "--from", "5b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710 5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "diff", "--to", "5b"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "diff", "--to", "5b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710 5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "restore", "5b"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "restore", "5b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710 5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "undo", "5b"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "undo", "5b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710 5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF] [EOF]
"); ");
@ -620,8 +620,8 @@ fn test_workspaces() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env; let test_env = test_env;
let stdout = test_env.jj_cmd_success(&main_path, &["--", "jj", "workspace", "forget", "def"]); let output = test_env.run_jj_in(&main_path, ["--", "jj", "workspace", "forget", "def"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
def-second (no description set) def-second (no description set)
default initial default initial
[EOF] [EOF]
@ -634,15 +634,15 @@ fn test_config() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let dir = test_env.env_root(); let dir = test_env.env_root();
let stdout = test_env.jj_cmd_success(dir, &["--", "jj", "config", "get", "c"]); let output = test_env.run_jj_in(dir, ["--", "jj", "config", "get", "c"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
core.fsmonitor Whether to use an external filesystem monitor, useful for large repos core.fsmonitor Whether to use an external filesystem monitor, useful for large repos
core.watchman.register_snapshot_trigger Whether to use triggers to monitor for changes in the background. core.watchman.register_snapshot_trigger Whether to use triggers to monitor for changes in the background.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(dir, &["--", "jj", "config", "list", "c"]); let output = test_env.run_jj_in(dir, ["--", "jj", "config", "list", "c"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
colors Mapping from jj formatter labels to colors colors Mapping from jj formatter labels to colors
core core
core.fsmonitor Whether to use an external filesystem monitor, useful for large repos core.fsmonitor Whether to use an external filesystem monitor, useful for large repos
@ -651,35 +651,35 @@ fn test_config() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(dir, &["--", "jj", "log", "--config", "c"]); let output = test_env.run_jj_in(dir, ["--", "jj", "log", "--config", "c"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
core.fsmonitor= Whether to use an external filesystem monitor, useful for large repos core.fsmonitor= Whether to use an external filesystem monitor, useful for large repos
core.watchman.register_snapshot_trigger= Whether to use triggers to monitor for changes in the background. core.watchman.register_snapshot_trigger= Whether to use triggers to monitor for changes in the background.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
dir, dir,
&["--", "jj", "log", "--config", "ui.conflict-marker-style="], ["--", "jj", "log", "--config", "ui.conflict-marker-style="],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
ui.conflict-marker-style=diff ui.conflict-marker-style=diff
ui.conflict-marker-style=snapshot ui.conflict-marker-style=snapshot
ui.conflict-marker-style=git ui.conflict-marker-style=git
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
dir, dir,
&["--", "jj", "log", "--config", "ui.conflict-marker-style=g"], ["--", "jj", "log", "--config", "ui.conflict-marker-style=g"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
ui.conflict-marker-style=git ui.conflict-marker-style=git
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
dir, dir,
&[ [
"--", "--",
"jj", "jj",
"log", "log",
@ -687,7 +687,7 @@ fn test_config() {
"git.abandon-unreachable-commits=", "git.abandon-unreachable-commits=",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
git.abandon-unreachable-commits=false git.abandon-unreachable-commits=false
git.abandon-unreachable-commits=true git.abandon-unreachable-commits=true
[EOF] [EOF]
@ -700,8 +700,8 @@ fn test_template_alias() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let dir = test_env.env_root(); let dir = test_env.env_root();
let stdout = test_env.jj_cmd_success(dir, &["--", "jj", "log", "-T", ""]); let output = test_env.run_jj_in(dir, ["--", "jj", "log", "-T", ""]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
builtin_log_comfortable builtin_log_comfortable
builtin_log_compact builtin_log_compact
builtin_log_compact_full_description builtin_log_compact_full_description
@ -840,8 +840,8 @@ fn test_files() {
], ],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "--summary"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
@ wqnwkozp test.user@example.com 2001-02-03 08:05:20 working_copy 45c3a621 @ wqnwkozp test.user@example.com 2001-02-03 08:05:20 working_copy 45c3a621
working_copy working_copy
A f_added_2 A f_added_2
@ -884,8 +884,8 @@ fn test_files() {
test_env.add_env_var("COMPLETE", "fish"); test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env; let test_env = test_env;
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "file", "show", "f_"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "file", "show", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added f_added
f_added_2 f_added_2
f_dir/ f_dir/
@ -896,9 +896,8 @@ fn test_files() {
[EOF] [EOF]
"); ");
let stdout = let output = test_env.run_jj_in(&repo_path, ["--", "jj", "file", "annotate", "-r@-", "f_"]);
test_env.jj_cmd_success(&repo_path, &["--", "jj", "file", "annotate", "-r@-", "f_"]); insta::assert_snapshot!(output.normalize_backslash(), @r"
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
f_added f_added
f_dir/ f_dir/
f_modified f_modified
@ -907,8 +906,8 @@ fn test_files() {
f_unchanged f_unchanged
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "diff", "-r", "@-", "f_"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "diff", "-r", "@-", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added Added f_added Added
f_deleted Deleted f_deleted Deleted
f_dir/ f_dir/
@ -917,9 +916,9 @@ fn test_files() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"--", "--",
"jj", "jj",
"diff", "diff",
@ -928,18 +927,18 @@ fn test_files() {
&format!("f_dir{}", std::path::MAIN_SEPARATOR), &format!("f_dir{}", std::path::MAIN_SEPARATOR),
], ],
); );
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
f_dir/dir_file_1 Added f_dir/dir_file_1 Added
f_dir/dir_file_2 Added f_dir/dir_file_2 Added
f_dir/dir_file_3 Added f_dir/dir_file_3 Added
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["--", "jj", "diff", "--from", "root()", "--to", "@-", "f_"], ["--", "jj", "diff", "--from", "root()", "--to", "@-", "f_"],
); );
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added Added f_added Added
f_dir/ f_dir/
f_modified Added f_modified Added
@ -950,9 +949,9 @@ fn test_files() {
"); ");
// interdiff has a different behavior with --from and --to flags // interdiff has a different behavior with --from and --to flags
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"--", "--",
"jj", "jj",
"interdiff", "interdiff",
@ -961,7 +960,7 @@ fn test_files() {
"f_", "f_",
], ],
); );
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
f_interdiff_only_from Added f_interdiff_only_from Added
f_interdiff_same Added f_interdiff_same Added
f_interdiff_only_to Added f_interdiff_only_to Added
@ -970,8 +969,8 @@ fn test_files() {
"); ");
// squash has a different behavior with --from and --to flags // squash has a different behavior with --from and --to flags
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "squash", "-f=first", "f_"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "squash", "-f=first", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
f_deleted Added f_deleted Added
f_modified Added f_modified Added
f_not_yet_renamed Added f_not_yet_renamed Added
@ -979,16 +978,15 @@ fn test_files() {
[EOF] [EOF]
"); ");
let stdout = let output = test_env.run_jj_in(&repo_path, ["--", "jj", "resolve", "-r=conflicted", "f_"]);
test_env.jj_cmd_success(&repo_path, &["--", "jj", "resolve", "-r=conflicted", "f_"]); insta::assert_snapshot!(output.normalize_backslash(), @r"
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
f_dir/ f_dir/
f_modified f_modified
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "log", "f_"]); let output = test_env.run_jj_in(&repo_path, ["--", "jj", "log", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added f_added
f_added_2 f_added_2
f_dir/ f_dir/
@ -998,9 +996,9 @@ fn test_files() {
f_unchanged f_unchanged
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"--", "--",
"jj", "jj",
"log", "log",
@ -1010,7 +1008,7 @@ fn test_files() {
"f_", "f_",
], ],
); );
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added_2 f_added_2
f_deleted f_deleted
f_dir/ f_dir/
@ -1021,6 +1019,6 @@ fn test_files() {
"); ");
let outside_repo = test_env.env_root(); let outside_repo = test_env.env_root();
let stdout = test_env.jj_cmd_success(outside_repo, &["--", "jj", "log", "f_"]); let output = test_env.run_jj_in(outside_repo, ["--", "jj", "log", "f_"]);
insta::assert_snapshot!(stdout, @r""); insta::assert_snapshot!(output, @r"");
} }

View File

@ -42,8 +42,8 @@ fn test_concurrent_operation_divergence() {
"#); "#);
// "op log --at-op" should work without merging the head operations // "op log --at-op" should work without merging the head operations
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--at-op=d74dff64472e"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "--at-op=d74dff64472e"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ d74dff64472e test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 @ d74dff64472e test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
args: jj describe -m 'message 2' --at-op @- args: jj describe -m 'message 2' --at-op @-
@ -76,8 +76,8 @@ fn test_concurrent_operations_auto_rebase() {
std::fs::write(repo_path.join("file"), "contents").unwrap(); std::fs::write(repo_path.join("file"), "contents").unwrap();
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ c62ace5c0522 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 @ c62ace5c0522 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
describe commit 4e8f9d2be039994f589b4e57ac5e9488703e604d describe commit 4e8f9d2be039994f589b4e57ac5e9488703e604d
args: jj describe -m initial args: jj describe -m initial
@ -89,7 +89,7 @@ fn test_concurrent_operations_auto_rebase() {
000000000000 root() 000000000000 root()
[EOF] [EOF]
"); ");
let op_id_hex = stdout.raw()[3..15].to_string(); let op_id_hex = output.stdout.raw()[3..15].to_string();
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "rewritten"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "rewritten"]);
test_env.jj_cmd_ok( test_env.jj_cmd_ok(
@ -145,8 +145,8 @@ fn test_concurrent_operations_wc_modified() {
Concurrent modification detected, resolving automatically. Concurrent modification detected, resolving automatically.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file b/file diff --git a/file b/file
index 12f00e90b6..2e0996000b 100644 index 12f00e90b6..2e0996000b 100644
--- a/file --- a/file
@ -158,8 +158,8 @@ fn test_concurrent_operations_wc_modified() {
"); ");
// The working copy should be committed after merging the operations // The working copy should be committed after merging the operations
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-Tdescription"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ snapshot working copy @ snapshot working copy
reconcile divergent operations reconcile divergent operations
@ -193,8 +193,8 @@ fn test_concurrent_snapshot_wc_reloadable() {
test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "new child1"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "new child1"]);
let template = r#"id ++ "\n" ++ description ++ "\n" ++ tags"#; let template = r#"id ++ "\n" ++ description ++ "\n" ++ tags"#;
let op_log_stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "-T", template]);
insta::assert_snapshot!(op_log_stdout, @r" insta::assert_snapshot!(output, @r"
@ ec6bf266624bbaed55833a34ae62fa95c0e9efa651b94eb28846972da645845052dcdc8580332a5628849f23f48b9e99fc728dc3fb13106df8d0666d746f8b85 @ ec6bf266624bbaed55833a34ae62fa95c0e9efa651b94eb28846972da645845052dcdc8580332a5628849f23f48b9e99fc728dc3fb13106df8d0666d746f8b85
commit 554d22b2c43c1c47e279430197363e8daabe2fd6 commit 554d22b2c43c1c47e279430197363e8daabe2fd6
args: jj commit -m 'new child1' args: jj commit -m 'new child1'
@ -213,7 +213,7 @@ fn test_concurrent_snapshot_wc_reloadable() {
[EOF] [EOF]
"); ");
let op_log_lines = op_log_stdout.raw().lines().collect_vec(); let op_log_lines = output.stdout.raw().lines().collect_vec();
let current_op_id = op_log_lines[0].split_once(" ").unwrap().1; let current_op_id = op_log_lines[0].split_once(" ").unwrap().1;
let previous_op_id = op_log_lines[6].split_once(" ").unwrap().1; let previous_op_id = op_log_lines[6].split_once(" ").unwrap().1;
@ -236,8 +236,8 @@ fn test_concurrent_snapshot_wc_reloadable() {
// Since the repo can be reloaded before snapshotting, "child2" should be // Since the repo can be reloaded before snapshotting, "child2" should be
// a child of "child1", not of "initial". // a child of "child1", not of "initial".
let template = r#"commit_id ++ " " ++ description"#; let template = r#"commit_id ++ " " ++ description"#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template, "-s"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", template, "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 1795621b54f4ebb435978b65d66bc0f90d8f20b6 new child2 @ 1795621b54f4ebb435978b65d66bc0f90d8f20b6 new child2
A child2 A child2
86f54245e13f850f8275b5541e56da996b6a47b7 new child1 86f54245e13f850f8275b5541e56da996b6a47b7 new child1

View File

@ -31,20 +31,20 @@ fn test_config_list_single() {
"#, "#,
); );
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["config", "list", "test-table.somekey"], ["config", "list", "test-table.somekey"],
); );
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
test-table.somekey = "some value" test-table.somekey = "some value"
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&["config", "list", r#"-Tname ++ "\n""#, "test-table.somekey"], ["config", "list", r#"-Tname ++ "\n""#, "test-table.somekey"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
test-table.somekey test-table.somekey
[EOF] [EOF]
"); ");
@ -76,10 +76,8 @@ fn test_config_list_table() {
"z"."with space"."function()" = 5 "z"."with space"."function()" = 5
"#, "#,
); );
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-table"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table"]);
insta::assert_snapshot!( insta::assert_snapshot!(output, @r#"
stdout,
@r#"
test-table.x = true test-table.x = true
test-table.y.foo = "abc" test-table.y.foo = "abc"
test-table.y.bar = 123 test-table.y.bar = 123
@ -96,16 +94,16 @@ fn test_config_list_inline_table() {
test-table = { x = true, y = 1 } test-table = { x = true, y = 1 }
"#, "#,
); );
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-table"]);
// Inline tables are expanded // Inline tables are expanded
insta::assert_snapshot!(stdout, @r" let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table"]);
insta::assert_snapshot!(output, @r"
test-table.x = true test-table.x = true
test-table.y = 1 test-table.y = 1
[EOF] [EOF]
"); ");
// Inner value can also be addressed by a dotted name path // Inner value can also be addressed by a dotted name path
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-table.x"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table.x"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
test-table.x = true test-table.x = true
[EOF] [EOF]
"); ");
@ -119,8 +117,8 @@ fn test_config_list_array() {
test-array = [1, "b", 3.4] test-array = [1, "b", 3.4]
"#, "#,
); );
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-array"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-array"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
test-array = [1, "b", 3.4] test-array = [1, "b", 3.4]
[EOF] [EOF]
"#); "#);
@ -139,8 +137,8 @@ fn test_config_list_array_of_tables() {
"#, "#,
); );
// Array is a value, so is array of tables // Array is a value, so is array of tables
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-table"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
test-table = [{ x = 1 }, { y = ["z"], z = { "key=with whitespace" = [] } }] test-table = [{ x = 1 }, { y = ["z"], z = { "key=with whitespace" = [] } }]
[EOF] [EOF]
"#); "#);
@ -182,8 +180,8 @@ bar
"#, "#,
); );
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "multiline"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "multiline"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
multiline = ''' multiline = '''
foo foo
bar bar
@ -191,9 +189,9 @@ bar
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&[ [
"config", "config",
"list", "list",
"multiline", "multiline",
@ -201,7 +199,7 @@ bar
"--config=multiline='single'", "--config=multiline='single'",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
# multiline = ''' # multiline = '''
# foo # foo
# bar # bar
@ -237,8 +235,8 @@ fn test_config_list_layer() {
], ],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--user"]); let output = test_env.run_jj_in(&repo_path, ["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
test-key = "test-val" test-key = "test-val"
test-layered-key = "test-original-val" test-layered-key = "test-original-val"
[EOF] [EOF]
@ -256,14 +254,14 @@ fn test_config_list_layer() {
], ],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--user"]); let output = test_env.run_jj_in(&repo_path, ["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
test-key = "test-val" test-key = "test-val"
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--repo"]); let output = test_env.run_jj_in(&repo_path, ["config", "list", "--repo"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
test-layered-key = "test-layered-val" test-layered-key = "test-layered-val"
[EOF] [EOF]
"#); "#);
@ -277,11 +275,11 @@ fn test_config_layer_override_default() {
let config_key = "merge-tools.vimdiff.program"; let config_key = "merge-tools.vimdiff.program";
// Default // Default
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["config", "list", config_key, "--include-defaults"], ["config", "list", config_key, "--include-defaults"],
); );
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
merge-tools.vimdiff.program = "vim" merge-tools.vimdiff.program = "vim"
[EOF] [EOF]
"#); "#);
@ -291,8 +289,8 @@ fn test_config_layer_override_default() {
"{config_key} = {value}\n", "{config_key} = {value}\n",
value = to_toml_value("user") value = to_toml_value("user")
)); ));
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
merge-tools.vimdiff.program = "user" merge-tools.vimdiff.program = "user"
[EOF] [EOF]
"#); "#);
@ -303,16 +301,16 @@ fn test_config_layer_override_default() {
format!("{config_key} = {value}\n", value = to_toml_value("repo")), format!("{config_key} = {value}\n", value = to_toml_value("repo")),
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
merge-tools.vimdiff.program = "repo" merge-tools.vimdiff.program = "repo"
[EOF] [EOF]
"#); "#);
// Command argument // Command argument
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"config", "config",
"list", "list",
config_key, config_key,
@ -320,15 +318,15 @@ fn test_config_layer_override_default() {
&format!("{config_key}={value}", value = to_toml_value("command-arg")), &format!("{config_key}={value}", value = to_toml_value("command-arg")),
], ],
); );
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
merge-tools.vimdiff.program = "command-arg" merge-tools.vimdiff.program = "command-arg"
[EOF] [EOF]
"#); "#);
// Allow printing overridden values // Allow printing overridden values
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"config", "config",
"list", "list",
config_key, config_key,
@ -337,16 +335,16 @@ fn test_config_layer_override_default() {
&format!("{config_key}={value}", value = to_toml_value("command-arg")), &format!("{config_key}={value}", value = to_toml_value("command-arg")),
], ],
); );
insta::assert_snapshot!(stdout, @r##" insta::assert_snapshot!(output, @r##"
# merge-tools.vimdiff.program = "user" # merge-tools.vimdiff.program = "user"
# merge-tools.vimdiff.program = "repo" # merge-tools.vimdiff.program = "repo"
merge-tools.vimdiff.program = "command-arg" merge-tools.vimdiff.program = "command-arg"
[EOF] [EOF]
"##); "##);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"config", "config",
"list", "list",
"--color=always", "--color=always",
@ -354,7 +352,7 @@ fn test_config_layer_override_default() {
"--include-overridden", "--include-overridden",
], ],
); );
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
# merge-tools.vimdiff.program = "user" # merge-tools.vimdiff.program = "user"
merge-tools.vimdiff.program = "repo" merge-tools.vimdiff.program = "repo"
[EOF] [EOF]
@ -370,8 +368,8 @@ fn test_config_layer_override_env() {
// Environment base // Environment base
test_env.add_env_var("EDITOR", "env-base"); test_env.add_env_var("EDITOR", "env-base");
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
ui.editor = "env-base" ui.editor = "env-base"
[EOF] [EOF]
"#); "#);
@ -381,8 +379,8 @@ fn test_config_layer_override_env() {
"{config_key} = {value}\n", "{config_key} = {value}\n",
value = to_toml_value("user") value = to_toml_value("user")
)); ));
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
ui.editor = "user" ui.editor = "user"
[EOF] [EOF]
"#); "#);
@ -393,24 +391,24 @@ fn test_config_layer_override_env() {
format!("{config_key} = {value}\n", value = to_toml_value("repo")), format!("{config_key} = {value}\n", value = to_toml_value("repo")),
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
ui.editor = "repo" ui.editor = "repo"
[EOF] [EOF]
"#); "#);
// Environment override // Environment override
test_env.add_env_var("JJ_EDITOR", "env-override"); test_env.add_env_var("JJ_EDITOR", "env-override");
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
ui.editor = "env-override" ui.editor = "env-override"
[EOF] [EOF]
"#); "#);
// Command argument // Command argument
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"config", "config",
"list", "list",
config_key, config_key,
@ -418,15 +416,15 @@ fn test_config_layer_override_env() {
&format!("{config_key}={value}", value = to_toml_value("command-arg")), &format!("{config_key}={value}", value = to_toml_value("command-arg")),
], ],
); );
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
ui.editor = "command-arg" ui.editor = "command-arg"
[EOF] [EOF]
"#); "#);
// Allow printing overridden values // Allow printing overridden values
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"config", "config",
"list", "list",
config_key, config_key,
@ -435,7 +433,7 @@ fn test_config_layer_override_env() {
&format!("{config_key}={value}", value = to_toml_value("command-arg")), &format!("{config_key}={value}", value = to_toml_value("command-arg")),
], ],
); );
insta::assert_snapshot!(stdout, @r##" insta::assert_snapshot!(output, @r##"
# ui.editor = "env-base" # ui.editor = "env-base"
# ui.editor = "user" # ui.editor = "user"
# ui.editor = "repo" # ui.editor = "repo"
@ -469,13 +467,13 @@ fn test_config_layer_workspace() {
), ),
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success(&main_path, &["config", "list", config_key]); let output = test_env.run_jj_in(&main_path, ["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
ui.editor = "main-repo" ui.editor = "main-repo"
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&secondary_path, &["config", "list", config_key]); let output = test_env.run_jj_in(&secondary_path, ["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
ui.editor = "main-repo" ui.editor = "main-repo"
[EOF] [EOF]
"#); "#);
@ -931,7 +929,7 @@ fn test_config_path() {
test_env.set_config_path(&user_config_path); test_env.set_config_path(&user_config_path);
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["config", "path", "--user"]), @r" test_env.run_jj_in(&repo_path, ["config", "path", "--user"]), @r"
$TEST_ENV/config.toml $TEST_ENV/config.toml
[EOF] [EOF]
"); ");
@ -941,7 +939,7 @@ fn test_config_path() {
); );
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["config", "path", "--repo"]), @r" test_env.run_jj_in(&repo_path, ["config", "path", "--repo"]), @r"
$TEST_ENV/repo/.jj/repo/config.toml $TEST_ENV/repo/.jj/repo/config.toml
[EOF] [EOF]
"); ");
@ -999,14 +997,14 @@ fn test_config_get() {
[exit status: 1] [exit status: 1]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "table.string"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.string"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
some value 1 some value 1
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "table.int"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.int"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
123 123
[EOF] [EOF]
"); ");
@ -1033,9 +1031,8 @@ fn test_config_get() {
[exit status: 1] [exit status: 1]
"); ");
let stdout = let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.overridden"]);
test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "table.overridden"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
bar bar
[EOF] [EOF]
"); ");
@ -1055,29 +1052,29 @@ fn test_config_path_syntax() {
"#, "#,
); );
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "a.'b()'"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "a.'b()'"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a.'b()' = 0 a.'b()' = 0
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
'b c'.d = 1 'b c'.d = 1
'b c'.e."f[]" = 2 'b c'.e."f[]" = 2
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'.d"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'.d"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
'b c'.d = 1 'b c'.d = 1
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'.e.'f[]'"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'.e.'f[]'"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
'b c'.e.'f[]' = 2 'b c'.e.'f[]' = 2
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "'b c'.e.'f[]'"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "'b c'.e.'f[]'"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
2 2
[EOF] [EOF]
"); ");
@ -1100,25 +1097,25 @@ fn test_config_path_syntax() {
"); ");
// "-" and "_" are valid TOML keys // "-" and "_" are valid TOML keys
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "-"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
- = 3 - = 3
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "_"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "_"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
_ = 4 _ = 4
[EOF] [EOF]
"); ");
// "." requires quoting // "." requires quoting
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'.'"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'.'"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
'.' = 5 '.' = 5
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "'.'"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "'.'"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
5 5
[EOF] [EOF]
"); ");
@ -1207,44 +1204,44 @@ fn test_config_conditional() {
.unwrap(); .unwrap();
// get and list should refer to the resolved config // get and list should refer to the resolved config
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "foo"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "foo"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
global global
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "get", "foo"]); let output = test_env.run_jj_in(&repo1_path, ["config", "get", "foo"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
repo1 repo1
[EOF] [EOF]
"); ");
// baz should be the same for `jj config get` and `jj config list` // baz should be the same for `jj config get` and `jj config list`
// qux should be different // qux should be different
let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "get", "baz"]); let output = test_env.run_jj_in(&repo1_path, ["config", "get", "baz"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
config config
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "get", "qux"]); let output = test_env.run_jj_in(&repo1_path, ["config", "get", "qux"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
get get
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "--user"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo = 'global' foo = 'global'
baz = 'config' baz = 'config'
qux = 'list' qux = 'list'
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "list", "--user"]); let output = test_env.run_jj_in(&repo1_path, ["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo = 'repo1' foo = 'repo1'
baz = 'config' baz = 'config'
qux = 'list' qux = 'list'
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo2_path, &["config", "list", "--user"]); let output = test_env.run_jj_in(&repo2_path, ["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo = 'repo2' foo = 'repo2'
baz = 'config' baz = 'config'
qux = 'list' qux = 'list'
@ -1252,8 +1249,8 @@ fn test_config_conditional() {
"); ");
// relative workspace path // relative workspace path
let stdout = test_env.jj_cmd_success(&repo2_path, &["config", "list", "--user", "-R../repo1"]); let output = test_env.run_jj_in(&repo2_path, ["config", "list", "--user", "-R../repo1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo = 'repo1' foo = 'repo1'
baz = 'config' baz = 'config'
qux = 'list' qux = 'list'
@ -1341,13 +1338,13 @@ fn test_config_conditional_without_home_dir() {
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "foo"]); let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "foo"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
global global
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "get", "foo"]); let output = test_env.run_jj_in(&repo_path, ["config", "get", "foo"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
repo repo
[EOF] [EOF]
"); ");

View File

@ -28,7 +28,7 @@ fn test_simple_rename() {
std::fs::write(repo_path.join("modified"), "original").unwrap(); std::fs::write(repo_path.join("modified"), "original").unwrap();
std::fs::write(repo_path.join("something"), "changed").unwrap(); std::fs::write(repo_path.join("something"), "changed").unwrap();
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "copy-detection"]).normalize_backslash(), @r" test_env.run_jj_in(&repo_path, ["debug", "copy-detection"]).normalize_backslash(), @r"
original -> modified original -> modified
[EOF] [EOF]
"); ");

View File

@ -24,8 +24,8 @@ fn test_debug_fileset() {
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let workspace_path = test_env.env_root().join("repo"); let workspace_path = test_env.env_root().join("repo");
let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "fileset", "all()"]); let output = test_env.run_jj_in(&workspace_path, ["debug", "fileset", "all()"]);
assert_snapshot!(stdout, @r" assert_snapshot!(output, @r"
-- Parsed: -- Parsed:
All All
@ -58,11 +58,11 @@ fn test_debug_revset() {
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let workspace_path = test_env.env_root().join("repo"); let workspace_path = test_env.env_root().join("repo");
let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "revset", "root()"]); let output = test_env.run_jj_in(&workspace_path, ["debug", "revset", "root()"]);
insta::with_settings!({filters => vec![ insta::with_settings!({filters => vec![
(r"(?m)(^ .*\n)+", " ..\n"), (r"(?m)(^ .*\n)+", " ..\n"),
]}, { ]}, {
assert_snapshot!(stdout, @r" assert_snapshot!(output, @r"
-- Parsed: -- Parsed:
Root Root
@ -168,8 +168,8 @@ fn test_debug_tree() {
std::fs::write(subdir.join("file2"), "contents 2").unwrap(); std::fs::write(subdir.join("file2"), "contents 2").unwrap();
// Defaults to showing the tree at the current commit // Defaults to showing the tree at the current commit
let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "tree"]); let output = test_env.run_jj_in(&workspace_path, ["debug", "tree"]);
assert_snapshot!(stdout.normalize_backslash(), @r#" assert_snapshot!(output.normalize_backslash(), @r#"
dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false }))) dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false })))
dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false })))
[EOF] [EOF]
@ -177,31 +177,31 @@ fn test_debug_tree() {
); );
// Can show the tree at another commit // Can show the tree at another commit
let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "tree", "-r@-"]); let output = test_env.run_jj_in(&workspace_path, ["debug", "tree", "-r@-"]);
assert_snapshot!(stdout.normalize_backslash(), @r#" assert_snapshot!(output.normalize_backslash(), @r#"
dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false }))) dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false })))
[EOF] [EOF]
"# "#
); );
// Can filter by paths // Can filter by paths
let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "tree", "dir/subdir/file2"]); let output = test_env.run_jj_in(&workspace_path, ["debug", "tree", "dir/subdir/file2"]);
assert_snapshot!(stdout.normalize_backslash(), @r#" assert_snapshot!(output.normalize_backslash(), @r#"
dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false })))
[EOF] [EOF]
"# "#
); );
// Can a show the root tree by id // Can a show the root tree by id
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&workspace_path, &workspace_path,
&[ [
"debug", "debug",
"tree", "tree",
"--id=0958358e3f80e794f032b25ed2be96cf5825da6c", "--id=0958358e3f80e794f032b25ed2be96cf5825da6c",
], ],
); );
assert_snapshot!(stdout.normalize_backslash(), @r#" assert_snapshot!(output.normalize_backslash(), @r#"
dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false }))) dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false })))
dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false })))
[EOF] [EOF]
@ -209,16 +209,16 @@ fn test_debug_tree() {
); );
// Can a show non-root tree by id // Can a show non-root tree by id
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&workspace_path, &workspace_path,
&[ [
"debug", "debug",
"tree", "tree",
"--dir=dir", "--dir=dir",
"--id=6ac232efa713535ae518a1a898b77e76c0478184", "--id=6ac232efa713535ae518a1a898b77e76c0478184",
], ],
); );
assert_snapshot!(stdout.normalize_backslash(), @r#" assert_snapshot!(output.normalize_backslash(), @r#"
dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false }))) dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false })))
dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false })))
[EOF] [EOF]
@ -226,9 +226,9 @@ fn test_debug_tree() {
); );
// Can filter by paths when showing non-root tree (matcher applies from root) // Can filter by paths when showing non-root tree (matcher applies from root)
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&workspace_path, &workspace_path,
&[ [
"debug", "debug",
"tree", "tree",
"--dir=dir", "--dir=dir",
@ -236,7 +236,7 @@ fn test_debug_tree() {
"dir/subdir/file2", "dir/subdir/file2",
], ],
); );
assert_snapshot!(stdout.normalize_backslash(), @r#" assert_snapshot!(output.normalize_backslash(), @r#"
dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false })))
[EOF] [EOF]
"# "#

View File

@ -97,9 +97,8 @@ fn test_describe() {
Parent commit : zzzzzzzz 00000000 (empty) (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set)
[EOF] [EOF]
"); ");
let stdout = let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
line1 line1
line2 line2
@ -125,9 +124,8 @@ fn test_describe() {
Parent commit : zzzzzzzz 00000000 (empty) (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set)
[EOF] [EOF]
"); ");
let stdout = let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
line1 line1
line2 line2
[EOF] [EOF]
@ -191,9 +189,8 @@ fn test_describe() {
Parent commit : zzzzzzzz 00000000 (empty) (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set)
[EOF] [EOF]
"); ");
let stdout = let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
description from editor description from editor
content of message from editor content of message from editor
@ -540,9 +537,8 @@ fn test_multiple_message_args() {
[EOF] [EOF]
"); ");
let stdout = let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
First Paragraph from CLI First Paragraph from CLI
Second Paragraph from CLI Second Paragraph from CLI
@ -586,9 +582,8 @@ fn test_multiple_message_args() {
[EOF] [EOF]
"); ");
let stdout = let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
First Paragraph from CLI First Paragraph from CLI

View File

@ -33,8 +33,8 @@ fn test_diff_basic() {
std::fs::write(repo_path.join("file3"), "foo\n").unwrap(); std::fs::write(repo_path.join("file3"), "foo\n").unwrap();
std::fs::write(repo_path.join("file4"), "1\n2\n3\n4\n").unwrap(); std::fs::write(repo_path.join("file4"), "1\n2\n3\n4\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file2: Modified regular file file2:
1 1: 1 1 1: 1
2 2: 25 2 2: 25
@ -45,8 +45,8 @@ fn test_diff_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=0"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--context=0"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file2: Modified regular file file2:
1 1: 1 1 1: 1
2 2: 25 2 2: 25
@ -57,8 +57,8 @@ fn test_diff_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--color=debug"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--color=debug"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<diff header::Modified regular file file2:>> <<diff header::Modified regular file file2:>>
<<diff removed line_number:: 1>><<diff:: >><<diff added line_number:: 1>><<diff::: 1>> <<diff removed line_number:: 1>><<diff:: >><<diff added line_number:: 1>><<diff::: 1>>
<<diff removed line_number:: 2>><<diff:: >><<diff added line_number:: 2>><<diff::: >><<diff removed token::2>><<diff added token::5>><<diff::>> <<diff removed line_number:: 2>><<diff:: >><<diff added line_number:: 2>><<diff::: >><<diff removed token::2>><<diff added token::5>><<diff::>>
@ -69,31 +69,31 @@ fn test_diff_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
M file2 M file2
R {file1 => file3} R {file1 => file3}
C {file2 => file4} C {file2 => file4}
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--types"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--types"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
FF file2 FF file2
FF {file1 => file3} FF {file1 => file3}
FF {file2 => file4} FF {file2 => file4}
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--types", "glob:file[12]"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--types", "glob:file[12]"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
F- file1 F- file1
FF file2 FF file2
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "file1"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
deleted file mode 100644 deleted file mode 100644
index 257cc5642c..0000000000 index 257cc5642c..0000000000
@ -104,8 +104,8 @@ fn test_diff_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file2 b/file2 diff --git a/file2 b/file2
index 94ebaf9001..1ffc51b472 100644 index 94ebaf9001..1ffc51b472 100644
--- a/file2 --- a/file2
@ -125,8 +125,8 @@ fn test_diff_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=0"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--context=0"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file2 b/file2 diff --git a/file2 b/file2
index 94ebaf9001..1ffc51b472 100644 index 94ebaf9001..1ffc51b472 100644
--- a/file2 --- a/file2
@ -145,8 +145,8 @@ fn test_diff_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--color=debug"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--color=debug"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<diff file_header::diff --git a/file2 b/file2>> <<diff file_header::diff --git a/file2 b/file2>>
<<diff file_header::index 94ebaf9001..1ffc51b472 100644>> <<diff file_header::index 94ebaf9001..1ffc51b472 100644>>
<<diff file_header::--- a/file2>> <<diff file_header::--- a/file2>>
@ -166,8 +166,8 @@ fn test_diff_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
M file2 M file2
R {file1 => file3} R {file1 => file3}
C {file2 => file4} C {file2 => file4}
@ -190,8 +190,8 @@ fn test_diff_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file2 | 3 +-- file2 | 3 +--
{file1 => file3} | 0 {file1 => file3} | 0
{file2 => file4} | 0 {file2 => file4} | 0
@ -200,8 +200,8 @@ fn test_diff_basic() {
"); ");
// Filter by glob pattern // Filter by glob pattern
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "glob:file[12]"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "glob:file[12]"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
[EOF] [EOF]
@ -244,8 +244,8 @@ fn test_diff_empty() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "").unwrap(); std::fs::write(repo_path.join("file1"), "").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Added regular file file1: Added regular file file1:
(empty) (empty)
[EOF] [EOF]
@ -253,15 +253,15 @@ fn test_diff_empty() {
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
std::fs::remove_file(repo_path.join("file1")).unwrap(); std::fs::remove_file(repo_path.join("file1")).unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Removed regular file file1: Removed regular file file1:
(empty) (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 | 0 file1 | 0
1 file changed, 0 insertions(+), 0 deletions(-) 1 file changed, 0 insertions(+), 0 deletions(-)
[EOF] [EOF]
@ -298,8 +298,8 @@ fn test_diff_file_mode() {
std::fs::remove_file(repo_path.join("file3")).unwrap(); std::fs::remove_file(repo_path.join("file3")).unwrap();
std::fs::remove_file(repo_path.join("file4")).unwrap(); std::fs::remove_file(repo_path.join("file4")).unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@--"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-r@--"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Added executable file file1: Added executable file file1:
(empty) (empty)
Added executable file file2: Added executable file file2:
@ -310,8 +310,8 @@ fn test_diff_file_mode() {
(empty) (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@-"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-r@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Executable file became non-executable at file1: Executable file became non-executable at file1:
1: 2 1: 2
Executable file became non-executable at file2: Executable file became non-executable at file2:
@ -320,8 +320,8 @@ fn test_diff_file_mode() {
Non-executable file became executable at file4: Non-executable file became executable at file4:
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-r@"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Removed regular file file1: Removed regular file file1:
1 : 2 1 : 2
Removed regular file file2: Removed regular file file2:
@ -333,8 +333,8 @@ fn test_diff_file_mode() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@--", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-r@--", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
new file mode 100755 new file mode 100755
index 0000000000..e69de29bb2 index 0000000000..e69de29bb2
@ -357,8 +357,8 @@ fn test_diff_file_mode() {
index 0000000000..e69de29bb2 index 0000000000..e69de29bb2
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@-", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-r@-", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
old mode 100755 old mode 100755
new mode 100644 new mode 100644
@ -384,8 +384,8 @@ fn test_diff_file_mode() {
new mode 100755 new mode 100755
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-r@", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
deleted file mode 100644 deleted file mode 100644
index 0cfbf08886..0000000000 index 0cfbf08886..0000000000
@ -497,7 +497,7 @@ fn test_diff_name_only() {
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
std::fs::write(repo_path.join("deleted"), "d").unwrap(); std::fs::write(repo_path.join("deleted"), "d").unwrap();
std::fs::write(repo_path.join("modified"), "m").unwrap(); std::fs::write(repo_path.join("modified"), "m").unwrap();
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--name-only"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--name-only"]), @r"
deleted deleted
modified modified
[EOF] [EOF]
@ -508,8 +508,8 @@ fn test_diff_name_only() {
std::fs::write(repo_path.join("added"), "add").unwrap(); std::fs::write(repo_path.join("added"), "add").unwrap();
std::fs::create_dir(repo_path.join("sub")).unwrap(); std::fs::create_dir(repo_path.join("sub")).unwrap();
std::fs::write(repo_path.join("sub/added"), "sub/add").unwrap(); std::fs::write(repo_path.join("sub/added"), "sub/add").unwrap();
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--name-only"]).normalize_backslash(), insta::assert_snapshot!(
@r" test_env.run_jj_in(&repo_path, ["diff", "--name-only"]).normalize_backslash(), @r"
added added
deleted deleted
modified modified
@ -575,9 +575,9 @@ fn test_diff_relative_paths() {
.unwrap(); .unwrap();
std::fs::write(repo_path.join("dir2").join("file4"), "bar4\n").unwrap(); std::fs::write(repo_path.join("dir2").join("file4"), "bar4\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff"]); let output = test_env.run_jj_in(&repo_path.join("dir1"), ["diff"]);
#[cfg(unix)] #[cfg(unix)]
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file2: Modified regular file file2:
1 1: foo2bar2 1 1: foo2bar2
Modified regular file subdir1/file3: Modified regular file subdir1/file3:
@ -589,7 +589,7 @@ fn test_diff_relative_paths() {
[EOF] [EOF]
"); ");
#[cfg(windows)] #[cfg(windows)]
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file2: Modified regular file file2:
1 1: foo2bar2 1 1: foo2bar2
Modified regular file subdir1\file3: Modified regular file subdir1\file3:
@ -601,9 +601,9 @@ fn test_diff_relative_paths() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path.join("dir1"), ["diff", "-s"]);
#[cfg(unix)] #[cfg(unix)]
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
M file2 M file2
M subdir1/file3 M subdir1/file3
M ../dir2/file4 M ../dir2/file4
@ -611,7 +611,7 @@ fn test_diff_relative_paths() {
[EOF] [EOF]
"); ");
#[cfg(windows)] #[cfg(windows)]
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
M file2 M file2
M subdir1\file3 M subdir1\file3
M ..\dir2\file4 M ..\dir2\file4
@ -619,9 +619,9 @@ fn test_diff_relative_paths() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "--types"]); let output = test_env.run_jj_in(&repo_path.join("dir1"), ["diff", "--types"]);
#[cfg(unix)] #[cfg(unix)]
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
FF file2 FF file2
FF subdir1/file3 FF subdir1/file3
FF ../dir2/file4 FF ../dir2/file4
@ -629,7 +629,7 @@ fn test_diff_relative_paths() {
[EOF] [EOF]
"); ");
#[cfg(windows)] #[cfg(windows)]
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
FF file2 FF file2
FF subdir1\file3 FF subdir1\file3
FF ..\dir2\file4 FF ..\dir2\file4
@ -637,8 +637,8 @@ fn test_diff_relative_paths() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path.join("dir1"), ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/dir1/file2 b/dir1/file2 diff --git a/dir1/file2 b/dir1/file2
index 54b060eee9..1fe912cdd8 100644 index 54b060eee9..1fe912cdd8 100644
--- a/dir1/file2 --- a/dir1/file2
@ -670,9 +670,9 @@ fn test_diff_relative_paths() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path.join("dir1"), ["diff", "--stat"]);
#[cfg(unix)] #[cfg(unix)]
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file2 | 2 +- file2 | 2 +-
subdir1/file3 | 2 +- subdir1/file3 | 2 +-
../dir2/file4 | 2 +- ../dir2/file4 | 2 +-
@ -681,7 +681,7 @@ fn test_diff_relative_paths() {
[EOF] [EOF]
"); ");
#[cfg(windows)] #[cfg(windows)]
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file2 | 2 +- file2 | 2 +-
subdir1\file3 | 2 +- subdir1\file3 | 2 +-
..\dir2\file4 | 2 +- ..\dir2\file4 | 2 +-
@ -707,8 +707,8 @@ fn test_diff_hunks() {
std::fs::write(repo_path.join("file2"), "").unwrap(); std::fs::write(repo_path.join("file2"), "").unwrap();
std::fs::write(repo_path.join("file3"), "foo\nbar\nbaz quux blah blah\n").unwrap(); std::fs::write(repo_path.join("file3"), "foo\nbar\nbaz quux blah blah\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
1: foo 1: foo
Modified regular file file2: Modified regular file file2:
@ -720,8 +720,8 @@ fn test_diff_hunks() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--color=debug"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--color=debug"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<diff header::Modified regular file file1:>> <<diff header::Modified regular file file1:>>
<<diff:: >><<diff added line_number:: 1>><<diff::: >><<diff added token::foo>> <<diff:: >><<diff added line_number:: 1>><<diff::: >><<diff added token::foo>>
<<diff header::Modified regular file file2:>> <<diff header::Modified regular file file2:>>
@ -733,8 +733,8 @@ fn test_diff_hunks() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index e69de29bb2..257cc5642c 100644 index e69de29bb2..257cc5642c 100644
--- a/file1 --- a/file1
@ -759,8 +759,8 @@ fn test_diff_hunks() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--color=debug"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--color=debug"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<diff file_header::diff --git a/file1 b/file1>> <<diff file_header::diff --git a/file1 b/file1>>
<<diff file_header::index e69de29bb2..257cc5642c 100644>> <<diff file_header::index e69de29bb2..257cc5642c 100644>>
<<diff file_header::--- a/file1>> <<diff file_header::--- a/file1>>
@ -905,8 +905,8 @@ fn test_diff_color_words_inlining_threshold() {
.unwrap(); .unwrap();
// default // default
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1-single-line: Modified regular file file1-single-line:
1 1: == adds == 1 1: == adds ==
2 2: a X b Y Z c 2 2: a X b Y Z c
@ -1355,8 +1355,8 @@ fn test_diff_missing_newline() {
std::fs::write(repo_path.join("file1"), "foo\nbar").unwrap(); std::fs::write(repo_path.join("file1"), "foo\nbar").unwrap();
std::fs::write(repo_path.join("file2"), "foo").unwrap(); std::fs::write(repo_path.join("file2"), "foo").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
1 1: foo 1 1: foo
2: bar 2: bar
@ -1366,8 +1366,8 @@ fn test_diff_missing_newline() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 1910281566..a907ec3f43 100644 index 1910281566..a907ec3f43 100644
--- a/file1 --- a/file1
@ -1391,8 +1391,8 @@ fn test_diff_missing_newline() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 | 3 ++- file1 | 3 ++-
file2 | 3 +-- file2 | 3 +--
2 files changed, 3 insertions(+), 3 deletions(-) 2 files changed, 3 insertions(+), 3 deletions(-)
@ -1423,9 +1423,9 @@ fn test_color_words_diff_missing_newline() {
std::fs::write(repo_path.join("file1"), "").unwrap(); std::fs::write(repo_path.join("file1"), "").unwrap();
test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "=== Empty"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "=== Empty"]);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-Tdescription", "-Tdescription",
"-pr::@-", "-pr::@-",
@ -1433,7 +1433,7 @@ fn test_color_words_diff_missing_newline() {
"--reversed", "--reversed",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== Empty === Empty
Added regular file file1: Added regular file file1:
(empty) (empty)
@ -1501,9 +1501,9 @@ fn test_color_words_diff_missing_newline() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"--config=diff.color-words.max-inline-alternation=0", "--config=diff.color-words.max-inline-alternation=0",
"-Tdescription", "-Tdescription",
@ -1512,7 +1512,7 @@ fn test_color_words_diff_missing_newline() {
"--reversed", "--reversed",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== Empty === Empty
Added regular file file1: Added regular file file1:
(empty) (empty)
@ -1618,8 +1618,8 @@ fn test_diff_ignore_whitespace() {
test_env.jj_cmd_ok(&repo_path, &["status"]); test_env.jj_cmd_ok(&repo_path, &["status"]);
// Git diff as reference output // Git diff as reference output
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--ignore-all-space"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--ignore-all-space"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index f532aa68ad..033c4a6168 100644 index f532aa68ad..033c4a6168 100644
--- a/file1 --- a/file1
@ -1633,8 +1633,8 @@ fn test_diff_ignore_whitespace() {
baz { } baz { }
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--ignore-space-change"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--ignore-space-change"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index f532aa68ad..033c4a6168 100644 index f532aa68ad..033c4a6168 100644
--- a/file1 --- a/file1
@ -1652,25 +1652,22 @@ fn test_diff_ignore_whitespace() {
"); ");
// Diff-stat should respects the whitespace options // Diff-stat should respects the whitespace options
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat", "--ignore-all-space"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat", "--ignore-all-space"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 | 2 ++ file1 | 2 ++
1 file changed, 2 insertions(+), 0 deletions(-) 1 file changed, 2 insertions(+), 0 deletions(-)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat", "--ignore-space-change"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat", "--ignore-space-change"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 | 6 ++++-- file1 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-) 1 file changed, 4 insertions(+), 2 deletions(-)
[EOF] [EOF]
"); ");
// Word-level changes are still highlighted // Word-level changes are still highlighted
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(&repo_path, ["diff", "--color=always", "--ignore-all-space"]);
&repo_path, insta::assert_snapshot!(output, @r"
&["diff", "--color=always", "--ignore-all-space"],
);
insta::assert_snapshot!(stdout, @r"
Modified regular file file1: Modified regular file file1:
 1: {  1: {
 1  2:  foo {  1  2:  foo {
@ -1680,11 +1677,11 @@ fn test_diff_ignore_whitespace() {
 4  6: baz { }  4  6: baz { }
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["diff", "--color=always", "--ignore-space-change"], ["diff", "--color=always", "--ignore-space-change"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
 1: {  1: {
 1  2:  foo {  1  2:  foo {
@ -1718,11 +1715,11 @@ fn test_diff_skipped_context() {
test_env.jj_cmd_ok(&repo_path, &["new", "@-", "-m", "=== 1 line at end"]); test_env.jj_cmd_ok(&repo_path, &["new", "@-", "-m", "=== 1 line at end"]);
std::fs::write(repo_path.join("file1"), "a\nb\nc\nd\ne\nF\ng\nh\ni\nj").unwrap(); std::fs::write(repo_path.join("file1"), "a\nb\nc\nd\ne\nF\ng\nh\ni\nj").unwrap();
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-Tdescription", "-p", "--no-graph", "--reversed"], ["log", "-Tdescription", "-p", "--no-graph", "--reversed"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== Left side of diffs === Left side of diffs
Added regular file file1: Added regular file file1:
1: a 1: a
@ -1827,11 +1824,11 @@ context = 0
test_env.jj_cmd_ok(&repo_path, &["new", "@", "-m", "=== Must show 0 context"]); test_env.jj_cmd_ok(&repo_path, &["new", "@", "-m", "=== Must show 0 context"]);
std::fs::write(repo_path.join("file1"), "a\nb\nC\nd\ne").unwrap(); std::fs::write(repo_path.join("file1"), "a\nb\nC\nd\ne").unwrap();
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-Tdescription", "-p", "--no-graph", "--reversed"], ["log", "-Tdescription", "-p", "--no-graph", "--reversed"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== First commit === First commit
Added regular file file1: Added regular file file1:
1: a 1: a
@ -1867,9 +1864,9 @@ context = 0
test_env.jj_cmd_ok(&repo_path, &["new", "@", "-m", "=== Must show 0 context"]); test_env.jj_cmd_ok(&repo_path, &["new", "@", "-m", "=== Must show 0 context"]);
std::fs::write(repo_path.join("file1"), "a\nb\nC\nd\ne").unwrap(); std::fs::write(repo_path.join("file1"), "a\nb\nC\nd\ne").unwrap();
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-Tdescription", "-Tdescription",
"-p", "-p",
@ -1878,7 +1875,7 @@ context = 0
"--reversed", "--reversed",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== First commit === First commit
diff --git a/file1 b/file1 diff --git a/file1 b/file1
new file mode 100644 new file mode 100644
@ -1924,9 +1921,9 @@ fn test_diff_skipped_context_nondefault() {
test_env.jj_cmd_ok(&repo_path, &["new", "@-", "-m", "=== 1 line at end"]); test_env.jj_cmd_ok(&repo_path, &["new", "@-", "-m", "=== 1 line at end"]);
std::fs::write(repo_path.join("file1"), "a\nb\nC\nd").unwrap(); std::fs::write(repo_path.join("file1"), "a\nb\nC\nd").unwrap();
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-Tdescription", "-Tdescription",
"-p", "-p",
@ -1935,7 +1932,7 @@ fn test_diff_skipped_context_nondefault() {
"--context=0", "--context=0",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
=== Left side of diffs === Left side of diffs
Added regular file file1: Added regular file file1:
1: a 1: a
@ -1993,8 +1990,8 @@ fn test_diff_leading_trailing_context() {
.unwrap(); .unwrap();
// N=5 <= num_context_lines + 1: No room to skip. // N=5 <= num_context_lines + 1: No room to skip.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=4"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--context=4"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
1 1: 1 1 1: 1
2 2: 2 2 2: 2
@ -2014,8 +2011,8 @@ fn test_diff_leading_trailing_context() {
// N=5 <= 2 * num_context_lines + 1: The last hunk wouldn't be split if // N=5 <= 2 * num_context_lines + 1: The last hunk wouldn't be split if
// trailing diff existed. // trailing diff existed.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=3"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--context=3"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
... ...
3 3: 3 3 3: 3
@ -2033,8 +2030,8 @@ fn test_diff_leading_trailing_context() {
// N=5 > 2 * num_context_lines + 1: The last hunk should be split no matter // N=5 > 2 * num_context_lines + 1: The last hunk should be split no matter
// if trailing diff existed. // if trailing diff existed.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=1"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--context=1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
... ...
5 5: 5 5 5: 5
@ -2047,8 +2044,8 @@ fn test_diff_leading_trailing_context() {
"); ");
// N=5 <= num_context_lines: No room to skip. // N=5 <= num_context_lines: No room to skip.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=5"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--context=5"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 1bf57dee4a..69b3e1865c 100644 index 1bf57dee4a..69b3e1865c 100644
--- a/file1 --- a/file1
@ -2072,8 +2069,8 @@ fn test_diff_leading_trailing_context() {
// N=5 <= 2 * num_context_lines: The last hunk wouldn't be split if // N=5 <= 2 * num_context_lines: The last hunk wouldn't be split if
// trailing diff existed. // trailing diff existed.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=3"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--context=3"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 1bf57dee4a..69b3e1865c 100644 index 1bf57dee4a..69b3e1865c 100644
--- a/file1 --- a/file1
@ -2093,8 +2090,8 @@ fn test_diff_leading_trailing_context() {
// N=5 > 2 * num_context_lines: The last hunk should be split no matter // N=5 > 2 * num_context_lines: The last hunk should be split no matter
// if trailing diff existed. // if trailing diff existed.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=2"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--context=2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 1bf57dee4a..69b3e1865c 100644 index 1bf57dee4a..69b3e1865c 100644
--- a/file1 --- a/file1
@ -2164,7 +2161,7 @@ fn test_diff_external_tool() {
// diff without file patterns // diff without file patterns
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor"]), @r" test_env.run_jj_in(&repo_path, ["diff", "--tool=fake-diff-editor"]), @r"
file1 file1
file2 file2
-- --
@ -2175,14 +2172,14 @@ fn test_diff_external_tool() {
// diff with file patterns // diff with file patterns
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor", "file1"]), @r" test_env.run_jj_in(&repo_path, ["diff", "--tool=fake-diff-editor", "file1"]), @r"
file1 file1
-- --
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-p", "--tool=fake-diff-editor"]), @r" test_env.run_jj_in(&repo_path, ["log", "-p", "--tool=fake-diff-editor"]), @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 39d9055d @ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 39d9055d
(no description set) (no description set)
file1 file1
@ -2201,7 +2198,7 @@ fn test_diff_external_tool() {
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["show", "--tool=fake-diff-editor"]), @r" test_env.run_jj_in(&repo_path, ["show", "--tool=fake-diff-editor"]), @r"
Commit ID: 39d9055d70873099fd924b9af218289d5663eac8 Commit ID: 39d9055d70873099fd924b9af218289d5663eac8
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -2219,7 +2216,7 @@ fn test_diff_external_tool() {
// Enabled by default, looks up the merge-tools table // Enabled by default, looks up the merge-tools table
let config = "--config=ui.diff.tool=fake-diff-editor"; let config = "--config=ui.diff.tool=fake-diff-editor";
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", config]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", config]), @r"
file1 file1
file2 file2
-- --
@ -2231,7 +2228,7 @@ fn test_diff_external_tool() {
// Inlined command arguments // Inlined command arguments
let command_toml = to_toml_value(fake_diff_editor_path()); let command_toml = to_toml_value(fake_diff_editor_path());
let config = format!("--config=ui.diff.tool=[{command_toml}, '$right', '$left']"); let config = format!("--config=ui.diff.tool=[{command_toml}, '$right', '$left']");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", &config]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", &config]), @r"
file2 file2
file3 file3
-- --
@ -2243,7 +2240,7 @@ fn test_diff_external_tool() {
// Output of external diff tool shouldn't be escaped // Output of external diff tool shouldn't be escaped
std::fs::write(&edit_script, "print \x1b[1;31mred").unwrap(); std::fs::write(&edit_script, "print \x1b[1;31mred").unwrap();
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["diff", "--color=always", "--tool=fake-diff-editor"]), test_env.run_jj_in(&repo_path, ["diff", "--color=always", "--tool=fake-diff-editor"]),
@r" @r"
red red
[EOF] [EOF]
@ -2424,7 +2421,7 @@ fn test_diff_external_tool_symlink() {
// Shouldn't try to change permission of symlinks // Shouldn't try to change permission of symlinks
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor"]), @r" test_env.run_jj_in(&repo_path, ["diff", "--tool=fake-diff-editor"]), @r"
dead dead
file file
-- --
@ -2554,8 +2551,8 @@ fn test_diff_stat() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap(); std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 | 1 + file1 | 1 +
1 file changed, 1 insertion(+), 0 deletions(-) 1 file changed, 1 insertion(+), 0 deletions(-)
[EOF] [EOF]
@ -2563,8 +2560,8 @@ fn test_diff_stat() {
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
0 files changed, 0 insertions(+), 0 deletions(-) 0 files changed, 0 insertions(+), 0 deletions(-)
[EOF] [EOF]
"); ");
@ -2573,8 +2570,8 @@ fn test_diff_stat() {
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
std::fs::write(repo_path.join("file1"), "bar\n").unwrap(); std::fs::write(repo_path.join("file1"), "bar\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 | 1 - file1 | 1 -
1 file changed, 0 insertions(+), 1 deletion(-) 1 file changed, 0 insertions(+), 1 deletion(-)
[EOF] [EOF]
@ -2727,8 +2724,8 @@ fn test_diff_binary() {
// try a file that's valid UTF-8 but contains control characters // try a file that's valid UTF-8 but contains control characters
std::fs::write(repo_path.join("file4.png"), b"\0\0\0").unwrap(); std::fs::write(repo_path.join("file4.png"), b"\0\0\0").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Removed regular file file1.png: Removed regular file file1.png:
(binary) (binary)
Modified regular file file2.png: Modified regular file file2.png:
@ -2740,8 +2737,8 @@ fn test_diff_binary() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1.png b/file1.png diff --git a/file1.png b/file1.png
deleted file mode 100644 deleted file mode 100644
index 2b65b23c22..0000000000 index 2b65b23c22..0000000000
@ -2760,8 +2757,8 @@ fn test_diff_binary() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1.png | 3 --- file1.png | 3 ---
file2.png | 5 ++--- file2.png | 5 ++---
file3.png | 3 +++ file3.png | 3 +++

View File

@ -58,8 +58,8 @@ fn test_diffedit() {
Adjust the right side until it shows the contents you want. If you Adjust the right side until it shows the contents you want. If you
don't make any changes, then the operation will be aborted. don't make any changes, then the operation will be aborted.
"###); "###);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
[EOF] [EOF]
@ -76,8 +76,8 @@ fn test_diffedit() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
[EOF] [EOF]
@ -102,8 +102,8 @@ fn test_diffedit() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
[EOF] [EOF]
@ -119,8 +119,8 @@ fn test_diffedit() {
[EOF] [EOF]
[exit status: 1] [exit status: 1]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
[EOF] [EOF]
@ -137,8 +137,8 @@ fn test_diffedit() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
[EOF] [EOF]
"); ");
@ -177,8 +177,8 @@ fn test_diffedit() {
Added 0 files, modified 0 files, removed 1 files Added 0 files, modified 0 files, removed 1 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
D file2 D file2
[EOF] [EOF]
@ -210,8 +210,8 @@ fn test_diffedit_new_file() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
A file2 A file2
[EOF] [EOF]
@ -228,8 +228,8 @@ fn test_diffedit_new_file() {
Added 1 files, modified 0 files, removed 0 files Added 1 files, modified 0 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
M file1 M file1
A file2 A file2
[EOF] [EOF]
@ -249,8 +249,8 @@ fn test_diffedit_new_file() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
A file2 A file2
[EOF] [EOF]
@ -430,8 +430,8 @@ fn test_diffedit_external_tool_conflict_marker_style() {
"##); "##);
// File should be conflicted with no changes // File should be conflicted with no changes
let stdout = test_env.jj_cmd_success(&repo_path, &["st"]); let output = test_env.run_jj_in(&repo_path, ["st"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
The working copy has no changes. The working copy has no changes.
Working copy : mzvwutvl fb39e804 (conflict) (empty) (no description set) Working copy : mzvwutvl fb39e804 (conflict) (empty) (no description set)
Parent commit: rlvkpnrz 3765cc27 side-a Parent commit: rlvkpnrz 3765cc27 side-a
@ -480,8 +480,8 @@ fn test_diffedit_3pane() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
[EOF] [EOF]
@ -496,8 +496,8 @@ fn test_diffedit_3pane() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
[EOF] [EOF]
@ -517,8 +517,8 @@ fn test_diffedit_3pane() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
[EOF] [EOF]
"); ");
@ -538,8 +538,8 @@ fn test_diffedit_3pane() {
Added 1 files, modified 0 files, removed 0 files Added 1 files, modified 0 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
M file1 M file1
M file2 M file2
[EOF] [EOF]
@ -557,8 +557,8 @@ fn test_diffedit_3pane() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
[EOF] [EOF]
@ -590,8 +590,8 @@ fn test_diffedit_merge() {
std::fs::write(repo_path.join("file3"), "d\n").unwrap(); std::fs::write(repo_path.join("file3"), "d\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
// Test the setup // Test the setup
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r", "@-", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-r", "@-", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
M file1 M file1
A file3 A file3
[EOF] [EOF]
@ -617,15 +617,15 @@ fn test_diffedit_merge() {
file2 2-sided conflict file2 2-sided conflict
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
A file3 A file3
[EOF] [EOF]
"); ");
assert!(!repo_path.join("file1").exists()); assert!(!repo_path.join("file1").exists());
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1 %%%%%%% Changes from base to side #1
-a -a
@ -659,8 +659,8 @@ fn test_diffedit_old_restore_interactive_tests() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
C {file2 => file3} C {file2 => file3}
@ -677,8 +677,8 @@ fn test_diffedit_old_restore_interactive_tests() {
[EOF] [EOF]
[exit status: 1] [exit status: 1]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
M file2 M file2
C {file2 => file3} C {file2 => file3}
@ -696,8 +696,8 @@ fn test_diffedit_old_restore_interactive_tests() {
Added 0 files, modified 1 files, removed 1 files Added 0 files, modified 1 files, removed 1 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
[EOF] [EOF]
"); ");
@ -714,8 +714,8 @@ fn test_diffedit_old_restore_interactive_tests() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
deleted file mode 100644 deleted file mode 100644
index 7898192261..0000000000 index 7898192261..0000000000
@ -769,8 +769,8 @@ fn test_diffedit_restore_descendants() {
Parent commit : rlvkpnrz 62b8c2ce (no description set) Parent commit : rlvkpnrz 62b8c2ce (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
diff --git a/file b/file diff --git a/file b/file
index 1a598a8fc9..7b6a85ab5a 100644 index 1a598a8fc9..7b6a85ab5a 100644
--- a/file --- a/file

View File

@ -28,8 +28,8 @@ fn test_evolog_with_or_without_diff() {
test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "@", "-d", "root()"]); test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "@", "-d", "root()"]);
std::fs::write(repo_path.join("file1"), "resolved\n").unwrap(); std::fs::write(repo_path.join("file1"), "resolved\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog"]); let output = test_env.run_jj_in(&repo_path, ["evolog"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 @ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description my description
× rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict × rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict
@ -42,8 +42,8 @@ fn test_evolog_with_or_without_diff() {
"); ");
// Color // Color
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "evolog"]); let output = test_env.run_jj_in(&repo_path, ["--color=always", "evolog"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 @ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description my description
× rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict × rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict
@ -57,8 +57,8 @@ fn test_evolog_with_or_without_diff() {
// There should be no diff caused by the rebase because it was a pure rebase // There should be no diff caused by the rebase because it was a pure rebase
// (even even though it resulted in a conflict). // (even even though it resulted in a conflict).
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "-p"]); let output = test_env.run_jj_in(&repo_path, ["evolog", "-p"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 @ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description my description
Resolved conflict in file1: Resolved conflict in file1:
@ -84,8 +84,8 @@ fn test_evolog_with_or_without_diff() {
"); ");
// Test `--limit` // Test `--limit`
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--limit=2"]); let output = test_env.run_jj_in(&repo_path, ["evolog", "--limit=2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 @ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description my description
× rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict × rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict
@ -94,8 +94,8 @@ fn test_evolog_with_or_without_diff() {
"); ");
// Test `--no-graph` // Test `--no-graph`
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--no-graph"]); let output = test_env.run_jj_in(&repo_path, ["evolog", "--no-graph"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description my description
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict
@ -108,8 +108,8 @@ fn test_evolog_with_or_without_diff() {
"); ");
// Test `--git` format, and that it implies `-p` // Test `--git` format, and that it implies `-p`
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--no-graph", "--git"]); let output = test_env.run_jj_in(&repo_path, ["evolog", "--no-graph", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description my description
diff --git a/file1 b/file1 diff --git a/file1 b/file1
@ -163,9 +163,9 @@ fn test_evolog_with_custom_symbols() {
std::fs::write(repo_path.join("file1"), "resolved\n").unwrap(); std::fs::write(repo_path.join("file1"), "resolved\n").unwrap();
let config = "templates.log_node='if(current_working_copy, \"$\", \"\")'"; let config = "templates.log_node='if(current_working_copy, \"$\", \"\")'";
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--config", config]); let output = test_env.run_jj_in(&repo_path, ["evolog", "--config", config]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
$ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 $ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description my description
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict
@ -269,9 +269,8 @@ fn test_evolog_squash() {
], ],
); );
let stdout = let output = test_env.run_jj_in(&repo_path, ["evolog", "-p", "-r", "description('squash')"]);
test_env.jj_cmd_success(&repo_path, &["evolog", "-p", "-r", "description('squash')"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
qpvuntsm test.user@example.com 2001-02-03 08:05:15 d49749bf qpvuntsm test.user@example.com 2001-02-03 08:05:15 d49749bf
squashed 3 squashed 3
vruxwmqv hidden test.user@example.com 2001-02-03 08:05:15 8f2ae2b5 vruxwmqv hidden test.user@example.com 2001-02-03 08:05:15 8f2ae2b5
@ -370,8 +369,8 @@ fn test_evolog_reversed_no_graph() {
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "a"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "a"]);
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "b"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "b"]);
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "c"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "c"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--reversed", "--no-graph"]); let output = test_env.run_jj_in(&repo_path, ["evolog", "--reversed", "--no-graph"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set) (empty) (no description set)
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 d8d5f980 qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 d8d5f980
@ -383,11 +382,11 @@ fn test_evolog_reversed_no_graph() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["evolog", "--limit=2", "--reversed", "--no-graph"], ["evolog", "--limit=2", "--reversed", "--no-graph"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:09 b4584f54 qpvuntsm hidden test.user@example.com 2001-02-03 08:05:09 b4584f54
(empty) b (empty) b
qpvuntsm test.user@example.com 2001-02-03 08:05:10 5cb22a87 qpvuntsm test.user@example.com 2001-02-03 08:05:10 5cb22a87
@ -419,11 +418,11 @@ fn test_evolog_reverse_with_graph() {
"c+d+e", "c+d+e",
], ],
); );
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["evolog", "-r", "description(c+d+e)", "--reversed"], ["evolog", "-r", "description(c+d+e)", "--reversed"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set) (empty) (no description set)
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 d8d5f980 qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 d8d5f980
@ -441,11 +440,11 @@ fn test_evolog_reverse_with_graph() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["evolog", "-rdescription(c+d+e)", "--limit=3", "--reversed"], ["evolog", "-rdescription(c+d+e)", "--limit=3", "--reversed"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
mzvwutvl hidden test.user@example.com 2001-02-03 08:05:11 280cbb6e mzvwutvl hidden test.user@example.com 2001-02-03 08:05:11 280cbb6e
(empty) d (empty) d
royxmykx hidden test.user@example.com 2001-02-03 08:05:12 031df638 royxmykx hidden test.user@example.com 2001-02-03 08:05:12 031df638

View File

@ -40,8 +40,8 @@ fn test_annotate_linear() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m=next"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m=next"]);
append_to_file(&repo_path.join("file.txt"), "new text from new commit"); append_to_file(&repo_path.join("file.txt"), "new text from new commit");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
qpvuntsm foo 2001-02-03 08:05:08 1: line1 qpvuntsm foo 2001-02-03 08:05:08 1: line1
kkmpptxz test.use 2001-02-03 08:05:10 2: new text from new commit kkmpptxz test.use 2001-02-03 08:05:10 2: new text from new commit
[EOF] [EOF]
@ -75,8 +75,8 @@ fn test_annotate_merge() {
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
qpvuntsm test.use 2001-02-03 08:05:08 1: line1 qpvuntsm test.use 2001-02-03 08:05:08 1: line1
zsuskuln test.use 2001-02-03 08:05:11 2: new text from new commit 1 zsuskuln test.use 2001-02-03 08:05:11 2: new text from new commit 1
royxmykx test.use 2001-02-03 08:05:13 3: new text from new commit 2 royxmykx test.use 2001-02-03 08:05:13 3: new text from new commit 2
@ -106,8 +106,8 @@ fn test_annotate_conflicted() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m=merged", "commit1", "commit2"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m=merged", "commit1", "commit2"]);
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
qpvuntsm test.use 2001-02-03 08:05:08 1: line1 qpvuntsm test.use 2001-02-03 08:05:08 1: line1
yostqsxw test.use 2001-02-03 08:05:15 2: <<<<<<< Conflict 1 of 1 yostqsxw test.use 2001-02-03 08:05:15 2: <<<<<<< Conflict 1 of 1
yostqsxw test.use 2001-02-03 08:05:15 3: %%%%%%% Changes from base to side #1 yostqsxw test.use 2001-02-03 08:05:15 3: %%%%%%% Changes from base to side #1
@ -146,8 +146,8 @@ fn test_annotate_merge_one_sided_conflict_resolution() {
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
qpvuntsm test.use 2001-02-03 08:05:08 1: line1 qpvuntsm test.use 2001-02-03 08:05:08 1: line1
zsuskuln test.use 2001-02-03 08:05:11 2: new text from new commit 1 zsuskuln test.use 2001-02-03 08:05:11 2: new text from new commit 1
[EOF] [EOF]
@ -186,11 +186,8 @@ fn test_annotate_with_template() {
) ++ "\n") ++ pad_start(4, line_number) ++ ": " ++ content ) ++ "\n") ++ pad_start(4, line_number) ++ ": " ++ content
"#}; "#};
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt", "-T", template]);
&repo_path, insta::assert_snapshot!(output, @r"
&["file", "annotate", "file.txt", "-T", template],
);
insta::assert_snapshot!(stdout, @r"
qpvuntsm initial qpvuntsm initial
2001-02-03 08:05:08 Test User <test.user@example.com> 2001-02-03 08:05:08 Test User <test.user@example.com>
1: line1 1: line1

View File

@ -72,14 +72,14 @@ fn test_chmod_regular_conflict() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]); let output = test_env.run_jj_in(&repo_path, ["debug", "tree"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r#" @r#"
file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })])) file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })]))
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1 %%%%%%% Changes from base to side #1
@ -93,14 +93,14 @@ fn test_chmod_regular_conflict() {
// Test chmodding a conflict // Test chmodding a conflict
test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "x", "file"]); test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "x", "file"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]); let output = test_env.run_jj_in(&repo_path, ["debug", "tree"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r#" @r#"
file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: true })])) file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: true })]))
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1 %%%%%%% Changes from base to side #1
@ -112,14 +112,14 @@ fn test_chmod_regular_conflict() {
[EOF] [EOF]
"); ");
test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "n", "file"]); test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "n", "file"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]); let output = test_env.run_jj_in(&repo_path, ["debug", "tree"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r#" @r#"
file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })])) file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })]))
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1 %%%%%%% Changes from base to side #1
@ -192,14 +192,14 @@ fn test_chmod_file_dir_deletion_conflicts() {
"); ");
// The file-dir conflict cannot be chmod-ed // The file-dir conflict cannot be chmod-ed
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_dir"]); let output = test_env.run_jj_in(&repo_path, ["debug", "tree", "-r=file_dir"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r#" @r#"
file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(Tree(TreeId("133bb38fc4e4bf6b551f1f04db7e48f04cac2877")))])) file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(Tree(TreeId("133bb38fc4e4bf6b551f1f04db7e48f04cac2877")))]))
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_dir", "file"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=file_dir", "file"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
Conflict: Conflict:
Removing file with id df967b96a579e45a18b8251732d16804b2e56a55 Removing file with id df967b96a579e45a18b8251732d16804b2e56a55
@ -216,14 +216,14 @@ fn test_chmod_file_dir_deletion_conflicts() {
"); ");
// The file_deletion conflict can be chmod-ed // The file_deletion conflict can be chmod-ed
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_deletion"]); let output = test_env.run_jj_in(&repo_path, ["debug", "tree", "-r=file_deletion"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r#" @r#"
file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), None])) file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), None]))
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_deletion", "file"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=file_deletion", "file"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
+++++++ Contents of side #1 +++++++ Contents of side #1
@ -254,14 +254,14 @@ fn test_chmod_file_dir_deletion_conflicts() {
Then run `jj squash` to move the resolution into the conflicted commit. Then run `jj squash` to move the resolution into the conflicted commit.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_deletion"]); let output = test_env.run_jj_in(&repo_path, ["debug", "tree", "-r=file_deletion"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r#" @r#"
file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), None])) file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), None]))
[EOF] [EOF]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_deletion", "file"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=file_deletion", "file"]);
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
+++++++ Contents of side #1 +++++++ Contents of side #1

View File

@ -27,15 +27,15 @@ fn test_show() {
std::fs::write(repo_path.join("dir").join("file2"), "c\n").unwrap(); std::fs::write(repo_path.join("dir").join("file2"), "c\n").unwrap();
// Can print the contents of a file in a commit // Can print the contents of a file in a commit
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
// Defaults to printing the working-copy version // Defaults to printing the working-copy version
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
@ -46,8 +46,8 @@ fn test_show() {
} else { } else {
"dir\\file2" "dir\\file2"
}; };
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", subdir_file]); let output = test_env.run_jj_in(&repo_path, ["file", "show", subdir_file]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
@ -62,15 +62,15 @@ fn test_show() {
"); ");
// Can print files under the specified directory // Can print files under the specified directory
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "dir"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
// Can print multiple files // Can print multiple files
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "."]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "."]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
b b
[EOF] [EOF]
@ -92,8 +92,8 @@ fn test_show() {
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
std::fs::write(repo_path.join("file1"), "c\n").unwrap(); std::fs::write(repo_path.join("file1"), "c\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "@", "-d", "@--"]); test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "@", "-d", "@--"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1 %%%%%%% Changes from base to side #1
-b -b

View File

@ -138,8 +138,8 @@ fn test_track_untrack_sparse() {
// When untracking a file that's not included in the sparse working copy, it // When untracking a file that's not included in the sparse working copy, it
// doesn't need to be ignored (because it won't be automatically added // doesn't need to be ignored (because it won't be automatically added
// back). // back).
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 file1
file2 file2
[EOF] [EOF]
@ -148,8 +148,8 @@ fn test_track_untrack_sparse() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "untrack", "file2"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "untrack", "file2"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 file1
[EOF] [EOF]
"); ");
@ -158,8 +158,8 @@ fn test_track_untrack_sparse() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "track", "file2"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "track", "file2"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 file1
[EOF] [EOF]
"); ");
@ -177,27 +177,27 @@ fn test_auto_track() {
std::fs::write(repo_path.join("file3.md"), "initial").unwrap(); std::fs::write(repo_path.join("file3.md"), "initial").unwrap();
// Only configured paths get auto-tracked // Only configured paths get auto-tracked
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1.rs file1.rs
[EOF] [EOF]
"); ");
// Can manually track paths // Can manually track paths
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file3.md"]); let output = test_env.run_jj_in(&repo_path, ["file", "track", "file3.md"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1.rs file1.rs
file3.md file3.md
[EOF] [EOF]
"); ");
// Can manually untrack paths // Can manually untrack paths
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "untrack", "file3.md"]); let output = test_env.run_jj_in(&repo_path, ["file", "untrack", "file3.md"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1.rs file1.rs
[EOF] [EOF]
"); ");
@ -206,17 +206,17 @@ fn test_auto_track() {
let subdir = repo_path.join("sub"); let subdir = repo_path.join("sub");
std::fs::create_dir(&subdir).unwrap(); std::fs::create_dir(&subdir).unwrap();
std::fs::write(subdir.join("file1.rs"), "initial").unwrap(); std::fs::write(subdir.join("file1.rs"), "initial").unwrap();
let stdout = test_env.jj_cmd_success(&subdir, &["file", "list"]); let output = test_env.run_jj_in(&subdir, ["file", "list"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
../file1.rs ../file1.rs
[EOF] [EOF]
"); ");
// But `jj file track` wants CWD-relative paths // But `jj file track` wants CWD-relative paths
let stdout = test_env.jj_cmd_success(&subdir, &["file", "track", "file1.rs"]); let output = test_env.run_jj_in(&subdir, ["file", "track", "file1.rs"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
let stdout = test_env.jj_cmd_success(&subdir, &["file", "list"]); let output = test_env.run_jj_in(&subdir, ["file", "list"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
../file1.rs ../file1.rs
file1.rs file1.rs
[EOF] [EOF]
@ -235,20 +235,20 @@ fn test_track_ignored() {
std::fs::write(repo_path.join("file1.bak"), "initial").unwrap(); std::fs::write(repo_path.join("file1.bak"), "initial").unwrap();
// Track an unignored path // Track an unignored path
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "track", "file1"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 file1
[EOF] [EOF]
"); ");
// Track an ignored path // Track an ignored path
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file1.bak"]); let output = test_env.run_jj_in(&repo_path, ["file", "track", "file1.bak"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
// TODO: We should teach `jj file track` to track ignored paths (possibly // TODO: We should teach `jj file track` to track ignored paths (possibly
// requiring a flag) // requiring a flag)
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 file1
[EOF] [EOF]
"); ");

View File

@ -62,8 +62,8 @@ fn test_config_no_tools() {
[exit status: 1] [exit status: 1]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
content content
[EOF] [EOF]
"); ");
@ -95,18 +95,18 @@ fn test_config_multiple_tools() {
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
FOO FOO
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
bar bar
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
Baz Baz
[EOF] [EOF]
"); ");
@ -156,13 +156,13 @@ fn test_config_multiple_tools_with_same_name() {
"); ");
test_env.set_config_path("/dev/null"); test_env.set_config_path("/dev/null");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
Foo Foo
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
Bar Bar
[EOF] [EOF]
"); ");
@ -201,18 +201,18 @@ fn test_config_disabled_tools() {
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
FOO FOO
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
bar bar
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
Baz Baz
[EOF] [EOF]
"); ");
@ -274,19 +274,19 @@ fn test_config_tables_overlapping_patterns() {
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
foo foo
tool-1[EOF] tool-1[EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
bar bar
tool-1 tool-1
tool-2[EOF] tool-2[EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
baz baz
tool-2[EOF] tool-2[EOF]
"); ");
@ -321,8 +321,8 @@ fn test_config_tables_all_commands_missing() {
[exit status: 1] [exit status: 1]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
foo foo
[EOF] [EOF]
"); ");
@ -361,8 +361,8 @@ fn test_config_tables_some_commands_missing() {
[exit status: 1] [exit status: 1]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
foo foo
[EOF] [EOF]
"); ");
@ -394,8 +394,8 @@ fn test_config_tables_empty_patterns_list() {
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
foo foo
[EOF] [EOF]
"); ");
@ -431,18 +431,18 @@ fn test_config_filesets() {
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a1", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "a1", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
A1 A1
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b1", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "b1", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
1b 1b
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b2", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "b2", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
2b 2b
[EOF] [EOF]
"); ");
@ -473,33 +473,33 @@ fn test_relative_paths() {
// repo-relative, so this command fixes the empty intersection of those // repo-relative, so this command fixes the empty intersection of those
// filesets. // filesets.
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix", "foo3"]); let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix", "foo3"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo1", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo1", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
unfixed unfixed
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
unfixed unfixed
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
unfixed unfixed
[EOF] [EOF]
"); ");
// Positional arguments can specify a subset of the configured fileset. // Positional arguments can specify a subset of the configured fileset.
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix", "../foo1"]); let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix", "../foo1"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo1", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo1", "-r", "@"]);
insta::assert_snapshot!(content, @"Fixed![EOF]"); insta::assert_snapshot!(output, @"Fixed![EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
unfixed unfixed
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
unfixed unfixed
[EOF] [EOF]
"); ");
@ -507,12 +507,12 @@ fn test_relative_paths() {
// The current directory does not change the interpretation of the config, so // The current directory does not change the interpretation of the config, so
// foo2 is fixed but not dir/foo3. // foo2 is fixed but not dir/foo3.
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix"]); let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo1", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo1", "-r", "@"]);
insta::assert_snapshot!(content, @"Fixed![EOF]"); insta::assert_snapshot!(output, @"Fixed![EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(content, @"Fixed![EOF]"); insta::assert_snapshot!(output, @"Fixed![EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
unfixed unfixed
[EOF] [EOF]
"); ");
@ -546,10 +546,10 @@ fn test_fix_leaf_commit() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@-"]);
insta::assert_snapshot!(content, @"unaffected[EOF]"); insta::assert_snapshot!(output, @"unaffected[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
AFFECTED AFFECTED
[EOF] [EOF]
"); ");
@ -577,18 +577,18 @@ fn test_fix_parent_commit() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "parent"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "parent"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
PARENT PARENT
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "child1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "child1"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CHILD1 CHILD1
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "child2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "child2"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CHILD2 CHILD2
[EOF] [EOF]
"); ");
@ -612,15 +612,15 @@ fn test_fix_sibling_commit() {
Fixed 1 commits of 1 checked. Fixed 1 commits of 1 checked.
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "parent"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "parent"]);
insta::assert_snapshot!(content, @"parent[EOF]"); insta::assert_snapshot!(output, @"parent[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "child1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "child1"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CHILD1 CHILD1
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "child2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "child2"]);
insta::assert_snapshot!(content, @"child2[EOF]"); insta::assert_snapshot!(output, @"child2[EOF]");
} }
#[test] #[test]
@ -658,24 +658,24 @@ fn test_default_revset() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "trunk1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "trunk1"]);
insta::assert_snapshot!(content, @"trunk1[EOF]"); insta::assert_snapshot!(output, @"trunk1[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "trunk2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "trunk2"]);
insta::assert_snapshot!(content, @"trunk2[EOF]"); insta::assert_snapshot!(output, @"trunk2[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "foo"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "foo"]);
insta::assert_snapshot!(content, @"foo[EOF]"); insta::assert_snapshot!(output, @"foo[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "bar1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "bar1"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
BAR1 BAR1
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "bar2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "bar2"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
BAR2 BAR2
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "bar3"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "bar3"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
BAR3 BAR3
[EOF] [EOF]
"); ");
@ -702,10 +702,10 @@ fn test_custom_default_revset() {
Fixed 1 commits of 1 checked. Fixed 1 commits of 1 checked.
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "foo"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "foo"]);
insta::assert_snapshot!(content, @"foo[EOF]"); insta::assert_snapshot!(output, @"foo[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "bar"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "bar"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
BAR BAR
[EOF] [EOF]
"); ");
@ -734,10 +734,10 @@ fn test_fix_immutable_commit() {
[EOF] [EOF]
[exit status: 1] [exit status: 1]
"##); "##);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "immutable"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "immutable"]);
insta::assert_snapshot!(content, @"immutable[EOF]"); insta::assert_snapshot!(output, @"immutable[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "mutable"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "mutable"]);
insta::assert_snapshot!(content, @"mutable[EOF]"); insta::assert_snapshot!(output, @"mutable[EOF]");
} }
#[test] #[test]
@ -752,8 +752,8 @@ fn test_fix_empty_file() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @""); insta::assert_snapshot!(output, @"");
} }
#[test] #[test]
@ -771,13 +771,13 @@ fn test_fix_some_paths() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
FOO FOO
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(content, @"bar[EOF]"); insta::assert_snapshot!(output, @"bar[EOF]");
} }
#[test] #[test]
@ -794,8 +794,8 @@ fn test_fix_cyclic() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
tnetnoc tnetnoc
[EOF] [EOF]
"); ");
@ -809,8 +809,8 @@ fn test_fix_cyclic() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
content content
[EOF] [EOF]
"); ");
@ -845,23 +845,23 @@ fn test_deduplication() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "a"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
FOO FOO
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "b"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
BAR BAR
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "c"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "c"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
BAR BAR
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "d"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "d"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
FOO FOO
[EOF] [EOF]
"); ");
@ -896,8 +896,8 @@ fn test_executed_but_nothing_changed() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
content content
[EOF] [EOF]
"); ");
@ -932,8 +932,8 @@ fn test_failure() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @"content[EOF]"); insta::assert_snapshot!(output, @"content[EOF]");
} }
#[test] #[test]
@ -953,8 +953,8 @@ fn test_stderr_success() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @"new content[EOF]"); insta::assert_snapshot!(output, @"new content[EOF]");
} }
#[test] #[test]
@ -970,8 +970,8 @@ fn test_stderr_failure() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @"old content[EOF]"); insta::assert_snapshot!(output, @"old content[EOF]");
} }
#[test] #[test]
@ -1012,8 +1012,8 @@ fn test_fix_file_types() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CONTENT CONTENT
[EOF] [EOF]
"); ");
@ -1038,8 +1038,8 @@ fn test_fix_executable() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CONTENT CONTENT
[EOF] [EOF]
"); ");
@ -1068,12 +1068,12 @@ fn test_fix_trivial_merge_commit() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_a", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_a", "-r", "@"]);
insta::assert_snapshot!(content, @"content a[EOF]"); insta::assert_snapshot!(output, @"content a[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_b", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_b", "-r", "@"]);
insta::assert_snapshot!(content, @"content b[EOF]"); insta::assert_snapshot!(output, @"content b[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_c", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_c", "-r", "@"]);
insta::assert_snapshot!(content, @"content c[EOF]"); insta::assert_snapshot!(output, @"content c[EOF]");
} }
#[test] #[test]
@ -1104,23 +1104,23 @@ fn test_fix_adding_merge_commit() {
Added 0 files, modified 4 files, removed 0 files Added 0 files, modified 4 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_a", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_a", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CHANGE A CHANGE A
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_b", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_b", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CHANGE B CHANGE B
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_c", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_c", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CHANGE C CHANGE C
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_d", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_d", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CHANGE D CHANGE D
[EOF] [EOF]
"); ");
@ -1150,18 +1150,18 @@ fn test_fix_both_sides_of_conflict() {
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "a"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CONTENT A CONTENT A
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "b"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CONTENT B CONTENT B
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1 %%%%%%% Changes from base to side #1
+CONTENT A +CONTENT A
@ -1196,8 +1196,8 @@ fn test_fix_resolve_conflict() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
CONTENT CONTENT
[EOF] [EOF]
"); ");
@ -1263,44 +1263,44 @@ fn test_all_files() {
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "a/a", "-r", "@-"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent aaa parent aaa
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "b/b", "-r", "@-"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent bbb parent bbb
fixed[EOF] fixed[EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "c/c", "-r", "@-"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent ccc parent ccc
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "ddd", "-r", "@-"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent ddd parent ddd
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "a/a", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
child aaa child aaa
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "b/b", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent bbb parent bbb
fixed[EOF] fixed[EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "c/c", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent ccc parent ccc
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "ddd", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
child ddd child ddd
[EOF] [EOF]
"); ");
@ -1316,46 +1316,46 @@ fn test_all_files() {
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "a/a", "-r", "@-"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent aaa parent aaa
fixed[EOF] fixed[EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "b/b", "-r", "@-"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent bbb parent bbb
fixed fixed
fixed[EOF] fixed[EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "c/c", "-r", "@-"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent ccc parent ccc
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "ddd", "-r", "@-"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent ddd parent ddd
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "a/a", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
child aaa child aaa
fixed[EOF] fixed[EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "b/b", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent bbb parent bbb
fixed fixed
fixed[EOF] fixed[EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "c/c", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
parent ccc parent ccc
[EOF] [EOF]
"); ");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "ddd", "-r", "@"]);
insta::assert_snapshot!(content, @r" insta::assert_snapshot!(output, @r"
child ddd child ddd
[EOF] [EOF]
"); ");

View File

@ -582,12 +582,12 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) {
} }
// "trunk()" alias should be set to default bookmark "main" // "trunk()" alias should be set to default bookmark "main"
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&test_env.env_root().join("clone1"), &test_env.env_root().join("clone1"),
&["config", "list", "--repo", "revset-aliases.'trunk()'"], ["config", "list", "--repo", "revset-aliases.'trunk()'"],
); );
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
revset-aliases.'trunk()' = "main@origin" revset-aliases.'trunk()' = "main@origin"
[EOF] [EOF]
"#); "#);
@ -646,12 +646,12 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) {
} }
// "trunk()" alias should be set to new default bookmark "feature1" // "trunk()" alias should be set to new default bookmark "feature1"
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&test_env.env_root().join("clone3"), &test_env.env_root().join("clone3"),
&["config", "list", "--repo", "revset-aliases.'trunk()'"], ["config", "list", "--repo", "revset-aliases.'trunk()'"],
); );
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
revset-aliases.'trunk()' = "feature1@origin" revset-aliases.'trunk()' = "feature1@origin"
[EOF] [EOF]
"#); "#);
@ -693,12 +693,12 @@ fn test_git_clone_remote_default_bookmark_with_escape(subprocess: bool) {
} }
// "trunk()" alias should be escaped and quoted // "trunk()" alias should be escaped and quoted
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&test_env.env_root().join("clone"), &test_env.env_root().join("clone"),
&["config", "list", "--repo", "revset-aliases.'trunk()'"], ["config", "list", "--repo", "revset-aliases.'trunk()'"],
); );
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
revset-aliases.'trunk()' = '"\""@origin' revset-aliases.'trunk()' = '"\""@origin'
[EOF] [EOF]
"#); "#);
@ -1171,9 +1171,9 @@ fn test_git_clone_malformed(subprocess: bool) {
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
} }
let stdout = test_env.jj_cmd_success(&clone_path, &["status"]); let output = test_env.run_jj_in(&clone_path, ["status"]);
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
The working copy has no changes. The working copy has no changes.
Working copy : zsuskuln f652c321 (empty) (no description set) Working copy : zsuskuln f652c321 (empty) (no description set)
Parent commit: zzzzzzzz 00000000 (empty) (no description set) Parent commit: zzzzzzzz 00000000 (empty) (no description set)

View File

@ -153,7 +153,7 @@ fn test_git_colocated_unborn_bookmark() {
"); ");
// Staged change shouldn't persist. // Staged change shouldn't persist.
checkout_index(); checkout_index();
insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&workspace_root, ["status"]), @r"
The working copy has no changes. The working copy has no changes.
Working copy : kkmpptxz fcdbbd73 (empty) (no description set) Working copy : kkmpptxz fcdbbd73 (empty) (no description set)
Parent commit: zzzzzzzz 00000000 (empty) (no description set) Parent commit: zzzzzzzz 00000000 (empty) (no description set)
@ -185,7 +185,7 @@ fn test_git_colocated_unborn_bookmark() {
"); ");
// Staged change shouldn't persist. // Staged change shouldn't persist.
checkout_index(); checkout_index();
insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&workspace_root, ["status"]), @r"
The working copy has no changes. The working copy has no changes.
Working copy : royxmykx 0e146103 (empty) (no description set) Working copy : royxmykx 0e146103 (empty) (no description set)
Parent commit: kkmpptxz e3e01407 (no description set) Parent commit: kkmpptxz e3e01407 (no description set)
@ -219,7 +219,7 @@ fn test_git_colocated_unborn_bookmark() {
"); ");
// Staged change shouldn't persist. // Staged change shouldn't persist.
checkout_index(); checkout_index();
insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&workspace_root, ["status"]), @r"
The working copy has no changes. The working copy has no changes.
Working copy : znkkpsqq 10dd328b (empty) (no description set) Working copy : znkkpsqq 10dd328b (empty) (no description set)
Parent commit: zzzzzzzz 00000000 (empty) (no description set) Parent commit: zzzzzzzz 00000000 (empty) (no description set)

View File

@ -97,7 +97,7 @@ fn test_git_export_undo() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-ra@git"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["log", "-ra@git"]), @r"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:07 a 230dd059 @ qpvuntsm test.user@example.com 2001-02-03 08:05:07 a 230dd059
(empty) (no description set) (empty) (no description set)
~ ~
@ -134,7 +134,7 @@ fn test_git_export_undo() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-ra@git"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["log", "-ra@git"]), @r"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:07 a 230dd059 @ qpvuntsm test.user@example.com 2001-02-03 08:05:07 a 230dd059
(empty) (no description set) (empty) (no description set)
~ ~

View File

@ -231,12 +231,12 @@ fn test_git_init_external_import_trunk(bare: bool) {
} }
// "trunk()" alias should be set to remote "origin"'s default bookmark "trunk" // "trunk()" alias should be set to remote "origin"'s default bookmark "trunk"
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&test_env.env_root().join("repo"), &test_env.env_root().join("repo"),
&["config", "list", "--repo", "revset-aliases.\"trunk()\""], ["config", "list", "--repo", "revset-aliases.\"trunk()\""],
); );
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r#" insta::assert_snapshot!(output, @r#"
revset-aliases."trunk()" = "trunk@origin" revset-aliases."trunk()" = "trunk@origin"
[EOF] [EOF]
"#); "#);
@ -658,8 +658,8 @@ fn test_git_init_colocated_dirty_working_copy() {
"#); "#);
// Working-copy changes should have been snapshotted. // Working-copy changes should have been snapshotted.
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-s", "--ignore-working-copy"]); let output = test_env.run_jj_in(&workspace_root, ["log", "-s", "--ignore-working-copy"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ sqpuoqvx test.user@example.com 2001-02-03 08:05:07 36dbd9a1 @ sqpuoqvx test.user@example.com 2001-02-03 08:05:07 36dbd9a1
(no description set) (no description set)
C {some-file => new-staged-file} C {some-file => new-staged-file}

View File

@ -837,9 +837,9 @@ fn test_git_push_multiple(subprocess: bool) {
[EOF] [EOF]
"); ");
} }
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-rall()"]); let output = test_env.run_jj_in(&workspace_root, ["log", "-rall()"]);
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ yqosqzyt test.user@example.com 2001-02-03 08:05:17 bookmark2 my-bookmark c4a3c310 @ yqosqzyt test.user@example.com 2001-02-03 08:05:17 bookmark2 my-bookmark c4a3c310
(empty) foo (empty) foo
rlzusymt test.user@example.com 2001-02-03 08:05:10 8476341e rlzusymt test.user@example.com 2001-02-03 08:05:10 8476341e
@ -948,9 +948,9 @@ fn test_git_push_changes(subprocess: bool) {
"push-yostqsxwqrlt", "push-yostqsxwqrlt",
], ],
); );
let stdout = test_env.jj_cmd_success(&workspace_root, &["status"]); let output = test_env.run_jj_in(&workspace_root, ["status"]);
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
M file M file
Working copy : yostqsxw 38cb417c bar Working copy : yostqsxw 38cb417c bar
@ -972,9 +972,9 @@ fn test_git_push_changes(subprocess: bool) {
[EOF] [EOF]
"); ");
} }
let stdout = test_env.jj_cmd_success(&workspace_root, &["status"]); let output = test_env.run_jj_in(&workspace_root, ["status"]);
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
M file M file
Working copy : yostqsxw 38cb417c push-yostqsxwqrlt | bar Working copy : yostqsxw 38cb417c push-yostqsxwqrlt | bar
@ -1670,9 +1670,9 @@ fn test_git_push_deleted(subprocess: bool) {
[EOF] [EOF]
"); ");
} }
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-rall()"]); let output = test_env.run_jj_in(&workspace_root, ["log", "-rall()"]);
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ yqosqzyt test.user@example.com 2001-02-03 08:05:13 5b36783c @ yqosqzyt test.user@example.com 2001-02-03 08:05:13 5b36783c
(empty) (no description set) (empty) (no description set)
rlzusymt test.user@example.com 2001-02-03 08:05:10 bookmark2 8476341e rlzusymt test.user@example.com 2001-02-03 08:05:10 bookmark2 8476341e

View File

@ -24,8 +24,8 @@ fn test_git_remotes() {
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
let (stdout, stderr) = test_env.jj_cmd_ok( let (stdout, stderr) = test_env.jj_cmd_ok(
&repo_path, &repo_path,
&["git", "remote", "add", "foo", "http://example.com/repo/foo"], &["git", "remote", "add", "foo", "http://example.com/repo/foo"],
@ -38,8 +38,8 @@ fn test_git_remotes() {
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
bar http://example.com/repo/bar bar http://example.com/repo/bar
foo http://example.com/repo/foo foo http://example.com/repo/foo
[EOF] [EOF]
@ -47,8 +47,8 @@ fn test_git_remotes() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "remote", "remove", "foo"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "remote", "remove", "foo"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
bar http://example.com/repo/bar bar http://example.com/repo/bar
[EOF] [EOF]
"); ");
@ -97,8 +97,8 @@ fn test_git_remote_add() {
[EOF] [EOF]
[exit status: 1] [exit status: 1]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo http://example.com/repo/foo foo http://example.com/repo/foo
[EOF] [EOF]
"); ");
@ -158,8 +158,8 @@ fn test_git_remote_set_url() {
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo http://example.com/repo/bar foo http://example.com/repo/bar
[EOF] [EOF]
"); ");
@ -177,8 +177,8 @@ fn test_git_remote_relative_path() {
&repo_path, &repo_path,
&["git", "remote", "add", "foo", path.to_str().unwrap()], &["git", "remote", "add", "foo", path.to_str().unwrap()],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo $TEST_ENV/native/sep foo $TEST_ENV/native/sep
[EOF] [EOF]
"); ");
@ -188,8 +188,8 @@ fn test_git_remote_relative_path() {
test_env.env_root(), test_env.env_root(),
&["-Rrepo", "git", "remote", "set-url", "foo", "unix/sep"], &["-Rrepo", "git", "remote", "set-url", "foo", "unix/sep"],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo $TEST_ENV/unix/sep foo $TEST_ENV/unix/sep
[EOF] [EOF]
"); ");
@ -234,8 +234,8 @@ fn test_git_remote_rename() {
test_env.jj_cmd_ok(&repo_path, &["git", "remote", "rename", "foo", "bar"]); test_env.jj_cmd_ok(&repo_path, &["git", "remote", "rename", "foo", "bar"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
bar http://example.com/repo/foo bar http://example.com/repo/foo
baz http://example.com/repo/baz baz http://example.com/repo/baz
[EOF] [EOF]
@ -260,14 +260,14 @@ fn test_git_remote_named_git() {
test_env.jj_cmd_ok(&repo_path, &["git", "remote", "rename", "git", "bar"]); test_env.jj_cmd_ok(&repo_path, &["git", "remote", "rename", "git", "bar"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
bar http://example.com/repo/repo bar http://example.com/repo/repo
[EOF] [EOF]
"); ");
// @git bookmark shouldn't be renamed. // @git bookmark shouldn't be renamed.
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-rmain@git", "-Tbookmarks"]); let output = test_env.run_jj_in(&repo_path, ["log", "-rmain@git", "-Tbookmarks"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ main @ main
~ ~
@ -292,12 +292,12 @@ fn test_git_remote_named_git() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "remote", "remove", "git"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "remote", "remove", "git"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r###" insta::assert_snapshot!(output, @r###"
"###); "###);
// @git bookmark shouldn't be removed. // @git bookmark shouldn't be removed.
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-rmain@git", "-Tbookmarks"]); let output = test_env.run_jj_in(&repo_path, ["log", "-rmain@git", "-Tbookmarks"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
main main
~ ~
@ -335,8 +335,8 @@ fn test_git_remote_with_slashes() {
[EOF] [EOF]
[exit status: 1] [exit status: 1]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
slash/origin http://example.com/repo/repo slash/origin http://example.com/repo/repo
[EOF] [EOF]
"); ");
@ -348,8 +348,8 @@ fn test_git_remote_with_slashes() {
); );
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
origin http://example.com/repo/repo origin http://example.com/repo/repo
[EOF] [EOF]
"); ");
@ -376,12 +376,12 @@ fn test_git_remote_with_slashes() {
test_env.jj_cmd_ok(&repo_path, &["git", "remote", "remove", "slash/origin"]); test_env.jj_cmd_ok(&repo_path, &["git", "remote", "remove", "slash/origin"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); let output = test_env.run_jj_in(&repo_path, ["git", "remote", "list"]);
insta::assert_snapshot!(stdout, @r###" insta::assert_snapshot!(output, @r###"
"###); "###);
// @git bookmark shouldn't be removed. // @git bookmark shouldn't be removed.
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-rmain@git", "-Tbookmarks"]); let output = test_env.run_jj_in(&repo_path, ["log", "-rmain@git", "-Tbookmarks"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
main main
~ ~

View File

@ -45,11 +45,11 @@ fn test_gitsubmodule_print_gitmodules() {
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&workspace_root, &workspace_root,
&["git", "submodule", "print-gitmodules", "-r", "@-"], ["git", "submodule", "print-gitmodules", "-r", "@-"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
name:old name:old
url:https://github.com/old/old.git url:https://github.com/old/old.git
path:old path:old
@ -58,9 +58,8 @@ fn test_gitsubmodule_print_gitmodules() {
[EOF] [EOF]
"); ");
let stdout = let output = test_env.run_jj_in(&workspace_root, ["git", "submodule", "print-gitmodules"]);
test_env.jj_cmd_success(&workspace_root, &["git", "submodule", "print-gitmodules"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
name:new name:new
url:https://github.com/new/new.git url:https://github.com/new/new.git
path:new path:new

View File

@ -58,8 +58,8 @@ fn test_gitignores() {
std::fs::write(workspace_root.join("file2"), "contents").unwrap(); std::fs::write(workspace_root.join("file2"), "contents").unwrap();
std::fs::write(workspace_root.join("file3"), "contents").unwrap(); std::fs::write(workspace_root.join("file3"), "contents").unwrap();
let stdout = test_env.jj_cmd_success(&workspace_root, &["diff", "-s"]); let output = test_env.run_jj_in(&workspace_root, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A .gitignore A .gitignore
A file0 A file0
A file3 A file3
@ -88,13 +88,13 @@ fn test_gitignores_relative_excludes_file_path() {
// core.excludesFile should be resolved relative to the workspace root, not // core.excludesFile should be resolved relative to the workspace root, not
// to the cwd. // to the cwd.
std::fs::create_dir(workspace_root.join("sub")).unwrap(); std::fs::create_dir(workspace_root.join("sub")).unwrap();
let stdout = test_env.jj_cmd_success(&workspace_root.join("sub"), &["diff", "-s"]); let output = test_env.run_jj_in(&workspace_root.join("sub"), ["diff", "-s"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
A ../not-ignored A ../not-ignored
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["-Rrepo", "diff", "-s"]); let output = test_env.run_jj_in(test_env.env_root(), ["-Rrepo", "diff", "-s"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
A repo/not-ignored A repo/not-ignored
[EOF] [EOF]
"); ");
@ -136,11 +136,11 @@ fn test_gitignores_ignored_file_in_target_commit() {
Discard the conflicting changes with `jj restore --from 5ada929e5d2e`. Discard the conflicting changes with `jj restore --from 5ada929e5d2e`.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&workspace_root, &workspace_root,
&["diff", "--git", "--from", &target_commit_id], ["diff", "--git", "--from", &target_commit_id],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/ignored b/ignored diff --git a/ignored b/ignored
index 8a69467466..4d9be5127b 100644 index 8a69467466..4d9be5127b 100644
--- a/ignored --- a/ignored

View File

@ -26,8 +26,8 @@ fn test_rewrite_immutable_generic() {
test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "main"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "main"]);
test_env.jj_cmd_ok(&repo_path, &["new", "main-", "-m=c"]); test_env.jj_cmd_ok(&repo_path, &["new", "main-", "-m=c"]);
std::fs::write(repo_path.join("file"), "c").unwrap(); std::fs::write(repo_path.join("file"), "c").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]); let output = test_env.run_jj_in(&repo_path, ["log"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ mzvwutvl test.user@example.com 2001-02-03 08:05:12 7adb43e8 @ mzvwutvl test.user@example.com 2001-02-03 08:05:12 7adb43e8
c c
kkmpptxz test.user@example.com 2001-02-03 08:05:10 main 72e1b68c kkmpptxz test.user@example.com 2001-02-03 08:05:10 main 72e1b68c

View File

@ -32,8 +32,8 @@ fn test_interdiff_basic() {
test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "right"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "right"]);
// implicit --to // implicit --to
let stdout = test_env.jj_cmd_success(&repo_path, &["interdiff", "--from", "left"]); let output = test_env.run_jj_in(&repo_path, ["interdiff", "--from", "left"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file2: Modified regular file file2:
1 1: foo 1 1: foo
2: bar 2: bar
@ -42,11 +42,8 @@ fn test_interdiff_basic() {
// explicit --to // explicit --to
test_env.jj_cmd_ok(&repo_path, &["new", "@-"]); test_env.jj_cmd_ok(&repo_path, &["new", "@-"]);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(&repo_path, ["interdiff", "--from", "left", "--to", "right"]);
&repo_path, insta::assert_snapshot!(output, @r"
&["interdiff", "--from", "left", "--to", "right"],
);
insta::assert_snapshot!(stdout, @r"
Modified regular file file2: Modified regular file file2:
1 1: foo 1 1: foo
2: bar 2: bar
@ -55,20 +52,20 @@ fn test_interdiff_basic() {
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
// formats specifiers // formats specifiers
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["interdiff", "--from", "left", "--to", "right", "-s"], ["interdiff", "--from", "left", "--to", "right", "-s"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
M file2 M file2
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["interdiff", "--from", "left", "--to", "right", "--git"], ["interdiff", "--from", "left", "--to", "right", "--git"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file2 b/file2 diff --git a/file2 b/file2
index 257cc5642c..3bd1f0e297 100644 index 257cc5642c..3bd1f0e297 100644
--- a/file2 --- a/file2
@ -101,19 +98,19 @@ fn test_interdiff_paths() {
std::fs::write(repo_path.join("file2"), "baz\n").unwrap(); std::fs::write(repo_path.join("file2"), "baz\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "right"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "right"]);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["interdiff", "--from", "left", "--to", "right", "file1"], ["interdiff", "--from", "left", "--to", "right", "file1"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
1 1: barbaz 1 1: barbaz
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"interdiff", "interdiff",
"--from", "--from",
"left", "left",
@ -123,7 +120,7 @@ fn test_interdiff_paths() {
"file2", "file2",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Modified regular file file1: Modified regular file file1:
1 1: barbaz 1 1: barbaz
Modified regular file file2: Modified regular file file2:
@ -149,11 +146,11 @@ fn test_interdiff_conflicting() {
std::fs::write(repo_path.join("file"), "def\n").unwrap(); std::fs::write(repo_path.join("file"), "def\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "right"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "right"]);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["interdiff", "--from", "left", "--to", "right", "--git"], ["interdiff", "--from", "left", "--to", "right", "--git"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
diff --git a/file b/file diff --git a/file b/file
index 0000000000..24c5735c3e 100644 index 0000000000..24c5735c3e 100644
--- a/file --- a/file

View File

@ -77,16 +77,16 @@ fn test_log_with_or_without_diff() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "a new commit"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "a new commit"]);
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap(); std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ a new commit @ a new commit
add a file add a file
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-p"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ a new commit @ a new commit
Modified regular file file1: Modified regular file file1:
1 1: foo 1 1: foo
@ -98,16 +98,16 @@ fn test_log_with_or_without_diff() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--no-graph"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--no-graph"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a new commit a new commit
add a file add a file
[EOF] [EOF]
"); ");
// `-p` for default diff output, `-s` for summary // `-p` for default diff output, `-s` for summary
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p", "-s"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-p", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ a new commit @ a new commit
M file1 M file1
Modified regular file file1: Modified regular file file1:
@ -122,8 +122,8 @@ fn test_log_with_or_without_diff() {
"); ");
// `-s` for summary, `--git` for git diff (which implies `-p`) // `-s` for summary, `--git` for git diff (which implies `-p`)
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s", "--git"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-s", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ a new commit @ a new commit
M file1 M file1
diff --git a/file1 b/file1 diff --git a/file1 b/file1
@ -147,9 +147,9 @@ fn test_log_with_or_without_diff() {
"); ");
// `-p` enables default "summary" output, so `-s` is noop // `-p` enables default "summary" output, so `-s` is noop
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-T", "-T",
"description", "description",
@ -158,7 +158,7 @@ fn test_log_with_or_without_diff() {
"--config=ui.diff.format=summary", "--config=ui.diff.format=summary",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ a new commit @ a new commit
M file1 M file1
add a file add a file
@ -168,11 +168,11 @@ fn test_log_with_or_without_diff() {
"); ");
// `-p` enables default "color-words" diff output, so `--color-words` is noop // `-p` enables default "color-words" diff output, so `--color-words` is noop
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "-p", "--color-words"], ["log", "-T", "description", "-p", "--color-words"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ a new commit @ a new commit
Modified regular file file1: Modified regular file file1:
1 1: foo 1 1: foo
@ -185,11 +185,11 @@ fn test_log_with_or_without_diff() {
"); ");
// `--git` enables git diff, so `-p` is noop // `--git` enables git diff, so `-p` is noop
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "--no-graph", "-p", "--git"], ["log", "-T", "description", "--no-graph", "-p", "--git"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a new commit a new commit
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 257cc5642c..3bd1f0e297 100644 index 257cc5642c..3bd1f0e297 100644
@ -234,8 +234,8 @@ fn test_log_with_or_without_diff() {
"); ");
// `-s` with or without graph // `-s` with or without graph
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ a new commit @ a new commit
M file1 M file1
add a file add a file
@ -243,11 +243,8 @@ fn test_log_with_or_without_diff() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--no-graph", "-s"]);
&repo_path, insta::assert_snapshot!(output, @r"
&["log", "-T", "description", "--no-graph", "-s"],
);
insta::assert_snapshot!(stdout, @r"
a new commit a new commit
M file1 M file1
add a file add a file
@ -256,11 +253,8 @@ fn test_log_with_or_without_diff() {
"); ");
// `--git` implies `-p`, with or without graph // `--git` implies `-p`, with or without graph
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-r", "@", "--git"]);
&repo_path, insta::assert_snapshot!(output, @r"
&["log", "-T", "description", "-r", "@", "--git"],
);
insta::assert_snapshot!(stdout, @r"
@ a new commit @ a new commit
diff --git a/file1 b/file1 diff --git a/file1 b/file1
~ index 257cc5642c..3bd1f0e297 100644 ~ index 257cc5642c..3bd1f0e297 100644
@ -271,11 +265,11 @@ fn test_log_with_or_without_diff() {
+bar +bar
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "-r", "@", "--no-graph", "--git"], ["log", "-T", "description", "-r", "@", "--no-graph", "--git"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a new commit a new commit
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 257cc5642c..3bd1f0e297 100644 index 257cc5642c..3bd1f0e297 100644
@ -288,20 +282,20 @@ fn test_log_with_or_without_diff() {
"); ");
// `--color-words` implies `-p`, with or without graph // `--color-words` implies `-p`, with or without graph
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "-r", "@", "--color-words"], ["log", "-T", "description", "-r", "@", "--color-words"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ a new commit @ a new commit
Modified regular file file1: Modified regular file file1:
~ 1 1: foo ~ 1 1: foo
2: bar 2: bar
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-T", "-T",
"description", "description",
@ -311,7 +305,7 @@ fn test_log_with_or_without_diff() {
"--color-words", "--color-words",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a new commit a new commit
Modified regular file file1: Modified regular file file1:
1 1: foo 1 1: foo
@ -551,7 +545,7 @@ fn test_log_prefix_highlight_styled() {
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
test_env.jj_cmd_ok(&repo_path, &["bookmark", "c", "-r@", "original"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "c", "-r@", "original"]);
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-r", "original", "-T", &prefix_format(Some(12))]), test_env.run_jj_in(&repo_path, ["log", "-r", "original", "-T", &prefix_format(Some(12))]),
@r" @r"
@ Change qpvuntsmwlqt initial e0e22b9fae75 original @ Change qpvuntsmwlqt initial e0e22b9fae75 original
@ -571,7 +565,7 @@ fn test_log_prefix_highlight_styled() {
} }
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-r", "original", "-T", &prefix_format(Some(12))]), test_env.run_jj_in(&repo_path, ["log", "-r", "original", "-T", &prefix_format(Some(12))]),
@r" @r"
Change qpvuntsmwlqt initial e0e22b9fae75 original Change qpvuntsmwlqt initial e0e22b9fae75 original
@ -579,9 +573,9 @@ fn test_log_prefix_highlight_styled() {
[EOF] [EOF]
" "
); );
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"--color=always", "--color=always",
"log", "log",
"-r", "-r",
@ -590,7 +584,7 @@ fn test_log_prefix_highlight_styled() {
&prefix_format(Some(12)), &prefix_format(Some(12)),
], ],
); );
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
@ Change wqnwkozpkust commit9 ede204633421 @ Change wqnwkozpkust commit9 ede204633421
Change kmkuslswpqwq commit8 ef3d013266cd Change kmkuslswpqwq commit8 ef3d013266cd
@ -606,9 +600,9 @@ fn test_log_prefix_highlight_styled() {
[EOF] [EOF]
" "
); );
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"--color=always", "--color=always",
"log", "log",
"-r", "-r",
@ -617,7 +611,7 @@ fn test_log_prefix_highlight_styled() {
&prefix_format(Some(3)), &prefix_format(Some(3)),
], ],
); );
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
@ Change wqn commit9 ede @ Change wqn commit9 ede
Change kmk commit8 ef3 Change kmk commit8 ef3
@ -633,9 +627,9 @@ fn test_log_prefix_highlight_styled() {
[EOF] [EOF]
" "
); );
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"--color=always", "--color=always",
"log", "log",
"-r", "-r",
@ -644,7 +638,7 @@ fn test_log_prefix_highlight_styled() {
&prefix_format(None), &prefix_format(None),
], ],
); );
insta::assert_snapshot!(stdout, insta::assert_snapshot!(output,
@r" @r"
@ Change wq commit9 ed @ Change wq commit9 ed
Change km commit8 ef3 Change km commit8 ef3
@ -690,7 +684,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() {
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
test_env.jj_cmd_ok(&repo_path, &["bookmark", "c", "-r@", "original"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "c", "-r@", "original"]);
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", prefix_format]), test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", prefix_format]),
@r" @r"
@ Change q[pvuntsmwlqt] initial e0[e22b9fae75] original @ Change q[pvuntsmwlqt] initial e0[e22b9fae75] original
Change z[zzzzzzzzzzz] 0[00000000000] Change z[zzzzzzzzzzz] 0[00000000000]
@ -707,7 +701,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() {
// The unique prefixes became longer. // The unique prefixes became longer.
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-T", prefix_format]), test_env.run_jj_in(&repo_path, ["log", "-T", prefix_format]),
@r" @r"
@ Change wq[nwkozpkust] 44[4c3c5066d3] @ Change wq[nwkozpkust] 44[4c3c5066d3]
Change qpv[untsmwlqt] initial e0e[22b9fae75] original Change qpv[untsmwlqt] initial e0e[22b9fae75] original
@ -726,7 +720,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() {
" "
); );
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-r", "44", "-T", prefix_format]), test_env.run_jj_in(&repo_path, ["log", "-r", "44", "-T", prefix_format]),
@r" @r"
@ Change wq[nwkozpkust] 44[4c3c5066d3] @ Change wq[nwkozpkust] 44[4c3c5066d3]
@ -776,7 +770,7 @@ fn test_log_author_format() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "--revisions=@"]), test_env.run_jj_in(&repo_path, ["log", "--revisions=@"]),
@r" @r"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059 @ qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set) (empty) (no description set)
@ -787,9 +781,9 @@ fn test_log_author_format() {
let decl = "template-aliases.'format_short_signature(signature)'"; let decl = "template-aliases.'format_short_signature(signature)'";
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success( test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"--config", "--config",
&format!("{decl}='signature.email().local()'"), &format!("{decl}='signature.email().local()'"),
"log", "log",
@ -814,9 +808,9 @@ fn test_log_divergence() {
std::fs::write(repo_path.join("file"), "foo\n").unwrap(); std::fs::write(repo_path.join("file"), "foo\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 1"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 1"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]);
// No divergence // No divergence
insta::assert_snapshot!(stdout, @r" let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(output, @r"
@ description 1 @ description 1
[EOF] [EOF]
@ -850,19 +844,19 @@ fn test_log_reversed() {
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "first"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "first"]);
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--reversed"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--reversed"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
first first
@ second @ second
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "--reversed", "--no-graph"], ["log", "-T", "description", "--reversed", "--no-graph"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
first first
second second
[EOF] [EOF]
@ -881,8 +875,8 @@ fn test_log_filtered_by_path() {
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap(); std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
std::fs::write(repo_path.join("file2"), "baz\n").unwrap(); std::fs::write(repo_path.join("file2"), "baz\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "file1"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ second @ second
first first
@ -890,16 +884,16 @@ fn test_log_filtered_by_path() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "file2"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ second @ second
~ ~
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s", "file1"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-s", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ second @ second
M file1 M file1
first first
@ -908,19 +902,19 @@ fn test_log_filtered_by_path() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "-s", "file2", "--no-graph"], ["log", "-T", "description", "-s", "file2", "--no-graph"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
second second
A file2 A file2
[EOF] [EOF]
"); ");
// empty revisions are filtered out by "all()" fileset. // empty revisions are filtered out by "all()" fileset.
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-Tdescription", "-s", "all()"]); let output = test_env.run_jj_in(&repo_path, ["log", "-Tdescription", "-s", "all()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ second @ second
M file1 M file1
A file2 A file2
@ -931,9 +925,9 @@ fn test_log_filtered_by_path() {
"); ");
// "root:<path>" is resolved relative to the workspace root. // "root:<path>" is resolved relative to the workspace root.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
test_env.env_root(), test_env.env_root(),
&[ [
"log", "log",
"-R", "-R",
repo_path.to_str().unwrap(), repo_path.to_str().unwrap(),
@ -942,7 +936,7 @@ fn test_log_filtered_by_path() {
"root:file1", "root:file1",
], ],
); );
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
@ second @ second
M repo/file1 M repo/file1
first first
@ -952,9 +946,9 @@ fn test_log_filtered_by_path() {
"); ");
// files() revset doesn't filter the diff. // files() revset doesn't filter the diff.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-T", "-T",
"description", "description",
@ -963,7 +957,7 @@ fn test_log_filtered_by_path() {
"--no-graph", "--no-graph",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
second second
M file1 M file1
A file2 A file2
@ -988,8 +982,8 @@ fn test_log_limit() {
&["new", "-m", "d", "description(c)", "description(b)"], &["new", "-m", "d", "description(c)", "description(b)"],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--limit=3"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--limit=3"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ d @ d
b b
@ -999,19 +993,19 @@ fn test_log_limit() {
"); ");
// Applied on sorted DAG // Applied on sorted DAG
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--limit=2"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--limit=2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ d @ d
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "--limit=2", "--no-graph"], ["log", "-T", "description", "--limit=2", "--no-graph"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
d d
c c
[EOF] [EOF]
@ -1019,20 +1013,20 @@ fn test_log_limit() {
// Applied on reversed DAG: Because the node "a" is omitted, "b" and "c" are // Applied on reversed DAG: Because the node "a" is omitted, "b" and "c" are
// rendered as roots. // rendered as roots.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "--limit=3", "--reversed"], ["log", "-T", "description", "--limit=3", "--reversed"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
b b
@ d @ d
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"-T", "-T",
"description", "description",
@ -1041,7 +1035,7 @@ fn test_log_limit() {
"--no-graph", "--no-graph",
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
c c
d d
@ -1049,11 +1043,11 @@ fn test_log_limit() {
"); ");
// Applied on filtered commits // Applied on filtered commits
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "description", "--limit=1", "b", "c"], ["log", "-T", "description", "--limit=1", "b", "c"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
~ ~
@ -1145,7 +1139,7 @@ fn test_default_revset() {
// The default revset is not used if a path is specified // The default revset is not used if a path is specified
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "file1", "-T", "description"]), test_env.run_jj_in(&repo_path, ["log", "file1", "-T", "description"]),
@r" @r"
@ add a file @ add a file
@ -1193,7 +1187,7 @@ fn test_multiple_revsets() {
test_env.add_config(r#"revsets.log = "root()""#); test_env.add_config(r#"revsets.log = "root()""#);
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-T", "bookmarks", "-rfoo"]), test_env.run_jj_in(&repo_path, ["log", "-T", "bookmarks", "-rfoo"]),
@r" @r"
foo foo
@ -1201,7 +1195,7 @@ fn test_multiple_revsets() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-T", "bookmarks", "-rfoo", "-rbar", "-rbaz"]), test_env.run_jj_in(&repo_path, ["log", "-T", "bookmarks", "-rfoo", "-rbar", "-rbaz"]),
@r" @r"
@ baz @ baz
bar bar
@ -1211,7 +1205,7 @@ fn test_multiple_revsets() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "-T", "bookmarks", "-rfoo", "-rfoo"]), test_env.run_jj_in(&repo_path, ["log", "-T", "bookmarks", "-rfoo", "-rfoo"]),
@r" @r"
foo foo
@ -1242,8 +1236,8 @@ fn test_graph_template_color() {
// First test without color for comparison // First test without color for comparison
let template = r#"label(if(current_working_copy, "working_copy"), description)"#; let template = r#"label(if(current_working_copy, "working_copy"), description)"#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ single line @ single line
first line first line
second line second line
@ -1251,8 +1245,8 @@ fn test_graph_template_color() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["--color=always", "log", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ single line @ single line
first line first line
second line second line
@ -1260,8 +1254,8 @@ fn test_graph_template_color() {
 
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=debug", "log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["--color=debug", "log", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<node working_copy::@>> <<log working_copy description::single line>> <<node working_copy::@>> <<log working_copy description::single line>>
<<node::>> <<log description::first line>> <<node::>> <<log description::first line>>
<<log description::second line>> <<log description::second line>>
@ -1297,8 +1291,8 @@ fn test_graph_styles() {
); );
// Default (curved) style // Default (curved) style
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ merge @ merge
side bookmark side bookmark
@ -1315,8 +1309,8 @@ fn test_graph_styles() {
// ASCII style // ASCII style
test_env.add_config(r#"ui.graph.style = "ascii""#); test_env.add_config(r#"ui.graph.style = "ascii""#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ merge @ merge
|\ |\
| o side bookmark | o side bookmark
@ -1333,8 +1327,8 @@ fn test_graph_styles() {
// Large ASCII style // Large ASCII style
test_env.add_config(r#"ui.graph.style = "ascii-large""#); test_env.add_config(r#"ui.graph.style = "ascii-large""#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ merge @ merge
|\ |\
| \ | \
@ -1353,8 +1347,8 @@ fn test_graph_styles() {
// Curved style // Curved style
test_env.add_config(r#"ui.graph.style = "curved""#); test_env.add_config(r#"ui.graph.style = "curved""#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ merge @ merge
side bookmark side bookmark
@ -1371,8 +1365,8 @@ fn test_graph_styles() {
// Square style // Square style
test_env.add_config(r#"ui.graph.style = "square""#); test_env.add_config(r#"ui.graph.style = "square""#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ merge @ merge
side bookmark side bookmark
@ -1746,11 +1740,11 @@ fn test_log_full_description_template() {
], ],
); );
let log = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["log", "-T", "builtin_log_compact_full_description"], ["log", "-T", "builtin_log_compact_full_description"],
); );
insta::assert_snapshot!(log, @r" insta::assert_snapshot!(output, @r"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:08 1c504ec6 @ qpvuntsm test.user@example.com 2001-02-03 08:05:08 1c504ec6
(empty) this is commit with a multiline description (empty) this is commit with a multiline description

View File

@ -93,10 +93,10 @@ fn test_new_merge() {
0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @"a[EOF]"); insta::assert_snapshot!(output, @"a[EOF]");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(stdout, @"b[EOF]"); insta::assert_snapshot!(output, @"b[EOF]");
// Same test with `--no-edit` // Same test with `--no-edit`
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
@ -438,8 +438,8 @@ fn test_new_insert_before_no_loop() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path); setup_before_insertion(&test_env, &repo_path);
let template = r#"commit_id.short() ++ " " ++ if(description, description, "root")"#; let template = r#"commit_id.short() ++ " " ++ if(description, description, "root")"#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 7705d353bf5d F @ 7705d353bf5d F
41a89ffcbba2 E 41a89ffcbba2 E
@ -625,8 +625,8 @@ fn test_new_insert_after_before_no_loop() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
setup_before_insertion(&test_env, &repo_path); setup_before_insertion(&test_env, &repo_path);
let template = r#"commit_id.short() ++ " " ++ if(description, description, "root")"#; let template = r#"commit_id.short() ++ " " ++ if(description, description, "root")"#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 7705d353bf5d F @ 7705d353bf5d F
41a89ffcbba2 E 41a89ffcbba2 E

View File

@ -29,8 +29,8 @@ fn test_op_log() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
@ d009cfc04993 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 @ d009cfc04993 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
args: jj describe -m 'description 0' args: jj describe -m 'description 0'
@ -39,7 +39,7 @@ fn test_op_log() {
000000000000 root() 000000000000 root()
[EOF] [EOF]
"); ");
let op_log_lines = stdout.raw().lines().collect_vec(); let op_log_lines = output.stdout.raw().lines().collect_vec();
let add_workspace_id = op_log_lines[3].split(' ').nth(2).unwrap(); let add_workspace_id = op_log_lines[3].split(' ').nth(2).unwrap();
// Can load the repo at a specific operation ID // Can load the repo at a specific operation ID
@ -76,8 +76,8 @@ fn test_op_log() {
[exit status: 1] [exit status: 1]
"#); "#);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--op-diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "--op-diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
@ d009cfc04993 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 @ d009cfc04993 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
args: jj describe -m 'description 0' args: jj describe -m 'description 0'
@ -121,15 +121,15 @@ fn test_op_log_with_custom_symbols() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"op", "op",
"log", "log",
"--config=templates.op_log_node='if(current_operation, \"$\", if(root, \"\", \"\"))'", "--config=templates.op_log_node='if(current_operation, \"$\", if(root, \"\", \"\"))'",
], ],
); );
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
$ d009cfc04993 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 $ d009cfc04993 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
args: jj describe -m 'description 0' args: jj describe -m 'description 0'
@ -180,8 +180,8 @@ fn test_op_log_limit() {
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-Tdescription", "--limit=1"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "-Tdescription", "--limit=1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ add workspace 'default' @ add workspace 'default'
[EOF] [EOF]
"); ");
@ -193,17 +193,16 @@ fn test_op_log_no_graph() {
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
let stdout = let output = test_env.run_jj_in(&repo_path, ["op", "log", "--no-graph", "--color=always"]);
test_env.jj_cmd_success(&repo_path, &["op", "log", "--no-graph", "--color=always"]); insta::assert_snapshot!(output, @r"
insta::assert_snapshot!(stdout, @r"
eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
add workspace 'default' add workspace 'default'
000000000000 root() 000000000000 root()
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--op-diff", "--no-graph"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "--op-diff", "--no-graph"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
add workspace 'default' add workspace 'default'
@ -221,8 +220,8 @@ fn test_op_log_reversed() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "--reversed"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
000000000000 root() 000000000000 root()
eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
add workspace 'default' add workspace 'default'
@ -260,8 +259,8 @@ fn test_op_log_reversed() {
"); ");
// Should work correctly with `--no-graph` // Should work correctly with `--no-graph`
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed", "--no-graph"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "--reversed", "--no-graph"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
000000000000 root() 000000000000 root()
eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
add workspace 'default' add workspace 'default'
@ -278,8 +277,8 @@ fn test_op_log_reversed() {
"); ");
// Should work correctly with `--limit` // Should work correctly with `--limit`
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed", "--limit=3"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "--reversed", "--limit=3"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
8e3e726be123 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 8e3e726be123 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
args: jj describe -m 'description 1' --at-op @- args: jj describe -m 'description 1' --at-op @-
@ -293,11 +292,11 @@ fn test_op_log_reversed() {
"); ");
// Should work correctly with `--limit` and `--no-graph` // Should work correctly with `--limit` and `--no-graph`
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["op", "log", "--reversed", "--limit=2", "--no-graph"], ["op", "log", "--reversed", "--limit=2", "--no-graph"],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
d009cfc04993 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 d009cfc04993 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
args: jj describe -m 'description 0' args: jj describe -m 'description 0'
@ -574,7 +573,7 @@ fn test_op_abandon_ancestors() {
test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "commit 1"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "commit 1"]);
test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "commit 2"]); test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "commit 2"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["op", "log"]), @r"
@ 116edde65ded test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 @ 116edde65ded test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00
commit 81a4ef3dd421f3184289df1c58bd3a16ea1e3d8e commit 81a4ef3dd421f3184289df1c58bd3a16ea1e3d8e
args: jj commit -m 'commit 2' args: jj commit -m 'commit 2'
@ -594,12 +593,12 @@ fn test_op_abandon_ancestors() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "local-working-copy", "--ignore-working-copy"]), @r#" test_env.run_jj_in(&repo_path, ["debug", "local-working-copy", "--ignore-working-copy"]), @r#"
Current operation: OperationId("8545e013752445fd845c84eb961dbfbce47e1deb628e4ef20df10f6dc9aae2ef9e47200b0fcc70ca51f050aede05d0fa6dd1db40e20ae740876775738a07d02e") Current operation: OperationId("8545e013752445fd845c84eb961dbfbce47e1deb628e4ef20df10f6dc9aae2ef9e47200b0fcc70ca51f050aede05d0fa6dd1db40e20ae740876775738a07d02e")
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904"))) Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
[EOF] [EOF]
"#); "#);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["op", "log"]), @r"
@ 8545e0137524 test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 @ 8545e0137524 test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00
commit 81a4ef3dd421f3184289df1c58bd3a16ea1e3d8e commit 81a4ef3dd421f3184289df1c58bd3a16ea1e3d8e
args: jj commit -m 'commit 2' args: jj commit -m 'commit 2'
@ -616,7 +615,7 @@ fn test_op_abandon_ancestors() {
Abandoned 2 operations and reparented 1 descendant operations. Abandoned 2 operations and reparented 1 descendant operations.
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["op", "log"]), @r"
@ d92d0753399f test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00 @ d92d0753399f test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
commit c5f7dd51add0046405055336ef443f882a0a8968 commit c5f7dd51add0046405055336ef443f882a0a8968
args: jj commit -m 'commit 5' args: jj commit -m 'commit 5'
@ -654,12 +653,12 @@ fn test_op_abandon_ancestors() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "local-working-copy", "--ignore-working-copy"]), @r#" test_env.run_jj_in(&repo_path, ["debug", "local-working-copy", "--ignore-working-copy"]), @r#"
Current operation: OperationId("0699d720d0cecd80fb7d765c45955708c61b12feb1d7ed9ff2777ae719471f04ffed3c1dc24efdbf94bdb74426065d6fa9a4f0862a89db2c8c8e359eefc45462") Current operation: OperationId("0699d720d0cecd80fb7d765c45955708c61b12feb1d7ed9ff2777ae719471f04ffed3c1dc24efdbf94bdb74426065d6fa9a4f0862a89db2c8c8e359eefc45462")
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904"))) Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
[EOF] [EOF]
"#); "#);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["op", "log"]), @r"
@ 0699d720d0ce test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00 @ 0699d720d0ce test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00
undo operation d92d0753399f732e438bdd88fa7e5214cba2a310d120ec1714028a514c7116bcf04b4a0b26c04dbecf0a917f1d4c8eb05571b8816dd98b0502aaf321e92500b3 undo operation d92d0753399f732e438bdd88fa7e5214cba2a310d120ec1714028a514c7116bcf04b4a0b26c04dbecf0a917f1d4c8eb05571b8816dd98b0502aaf321e92500b3
args: jj undo args: jj undo
@ -676,7 +675,7 @@ fn test_op_abandon_ancestors() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["op", "log", "-n1"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["op", "log", "-n1"]), @r"
@ 0699d720d0ce test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00 @ 0699d720d0ce test-username@host.example.com 2001-02-03 04:05:21.000 +07:00 - 2001-02-03 04:05:21.000 +07:00
undo operation d92d0753399f732e438bdd88fa7e5214cba2a310d120ec1714028a514c7116bcf04b4a0b26c04dbecf0a917f1d4c8eb05571b8816dd98b0502aaf321e92500b3 undo operation d92d0753399f732e438bdd88fa7e5214cba2a310d120ec1714028a514c7116bcf04b4a0b26c04dbecf0a917f1d4c8eb05571b8816dd98b0502aaf321e92500b3
args: jj undo args: jj undo
@ -704,13 +703,13 @@ fn test_op_abandon_without_updating_working_copy() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "local-working-copy", "--ignore-working-copy"]), @r#" test_env.run_jj_in(&repo_path, ["debug", "local-working-copy", "--ignore-working-copy"]), @r#"
Current operation: OperationId("b0711a8ac91f5ac088cff9b57c9daf29dc61b1b4fedcbb9a07fe4c7f7da1e60e333c787eacf73d1e0544db048a4fe9c6c089991b4a67e25365c4f411fa8b489f") Current operation: OperationId("b0711a8ac91f5ac088cff9b57c9daf29dc61b1b4fedcbb9a07fe4c7f7da1e60e333c787eacf73d1e0544db048a4fe9c6c089991b4a67e25365c4f411fa8b489f")
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904"))) Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
[EOF] [EOF]
"#); "#);
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["op", "log", "-n1", "--ignore-working-copy"]), @r" test_env.run_jj_in(&repo_path, ["op", "log", "-n1", "--ignore-working-copy"]), @r"
@ 0508a30825ed test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 @ 0508a30825ed test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00
commit 220cb0b1b5d1c03cc0d351139d824598bb3c1967 commit 220cb0b1b5d1c03cc0d351139d824598bb3c1967
args: jj commit -m 'commit 3' args: jj commit -m 'commit 3'
@ -727,13 +726,13 @@ fn test_op_abandon_without_updating_working_copy() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["debug", "local-working-copy", "--ignore-working-copy"]), @r#" test_env.run_jj_in(&repo_path, ["debug", "local-working-copy", "--ignore-working-copy"]), @r#"
Current operation: OperationId("b0711a8ac91f5ac088cff9b57c9daf29dc61b1b4fedcbb9a07fe4c7f7da1e60e333c787eacf73d1e0544db048a4fe9c6c089991b4a67e25365c4f411fa8b489f") Current operation: OperationId("b0711a8ac91f5ac088cff9b57c9daf29dc61b1b4fedcbb9a07fe4c7f7da1e60e333c787eacf73d1e0544db048a4fe9c6c089991b4a67e25365c4f411fa8b489f")
Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904"))) Current tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
[EOF] [EOF]
"#); "#);
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["op", "log", "-n1", "--ignore-working-copy"]), @r" test_env.run_jj_in(&repo_path, ["op", "log", "-n1", "--ignore-working-copy"]), @r"
@ 2631d5576876 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 @ 2631d5576876 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00
commit 220cb0b1b5d1c03cc0d351139d824598bb3c1967 commit 220cb0b1b5d1c03cc0d351139d824598bb3c1967
args: jj commit -m 'commit 3' args: jj commit -m 'commit 3'
@ -957,9 +956,9 @@ fn test_op_summary_diff_template() {
Undid operation: ac20a4ff4791 (2001-02-03 08:05:08) new empty commit Undid operation: ac20a4ff4791 (2001-02-03 08:05:08) new empty commit
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"op", "op",
"diff", "diff",
"--from", "--from",
@ -969,7 +968,7 @@ fn test_op_summary_diff_template() {
"--color=always", "--color=always",
], ],
); );
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 000000000000 root() From operation: 000000000000 root()
To operation: e3792fce5b1f (2001-02-03 08:05:09) undo operation ac20a4ff47914da9a2e43677b94455b86383bfb9227374d6531ecee85b9ff9230eeb96416a24bb27e7477aa18d50c01810e97c6a008b5c584224650846f4c05b To operation: e3792fce5b1f (2001-02-03 08:05:09) undo operation ac20a4ff47914da9a2e43677b94455b86383bfb9227374d6531ecee85b9ff9230eeb96416a24bb27e7477aa18d50c01810e97c6a008b5c584224650846f4c05b
@ -986,9 +985,9 @@ fn test_op_summary_diff_template() {
Undid operation: <<operation id short::2301f6e6ec31>><<operation:: (>><<operation time end local format::2001-02-03 08:05:11>><<operation::) >><<operation description first_line::new empty commit>> Undid operation: <<operation id short::2301f6e6ec31>><<operation:: (>><<operation time end local format::2001-02-03 08:05:11>><<operation::) >><<operation description first_line::new empty commit>>
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"op", "op",
"diff", "diff",
"--from", "--from",
@ -998,7 +997,7 @@ fn test_op_summary_diff_template() {
"--color=debug", "--color=debug",
], ],
); );
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: <<operation id short::000000000000>><<operation:: >><<operation root::root()>> From operation: <<operation id short::000000000000>><<operation:: >><<operation root::root()>>
To operation: <<operation id short::d208ae1b4e3c>><<operation:: (>><<operation time end local format::2001-02-03 08:05:12>><<operation::) >><<operation description first_line::undo operation 2301f6e6ec31931a9b0a594742d6035a44c05250d1707f7f8678e888b11a98773ef07bf0e8008a5bccddf7114da4a35d1a1b1f7efa37c1e6c80d6bdb8f0d7a90>> To operation: <<operation id short::d208ae1b4e3c>><<operation:: (>><<operation time end local format::2001-02-03 08:05:12>><<operation::) >><<operation description first_line::undo operation 2301f6e6ec31931a9b0a594742d6035a44c05250d1707f7f8678e888b11a98773ef07bf0e8008a5bccddf7114da4a35d1a1b1f7efa37c1e6c80d6bdb8f0d7a90>>
@ -1017,8 +1016,8 @@ fn test_op_diff() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
// Overview of op log. // Overview of op log.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
@ 364d0a677b0c test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 @ 364d0a677b0c test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
check out git remote's default branch check out git remote's default branch
args: jj git clone git-repo repo args: jj git clone git-repo repo
@ -1032,17 +1031,17 @@ fn test_op_diff() {
"); ");
// Diff between the same operation should be empty. // Diff between the same operation should be empty.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["op", "diff", "--from", "0000000", "--to", "0000000"], ["op", "diff", "--from", "0000000", "--to", "0000000"],
); );
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 000000000000 root() From operation: 000000000000 root()
To operation: 000000000000 root() To operation: 000000000000 root()
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--from", "@", "--to", "@"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--from", "@", "--to", "@"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch From operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch
To operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch To operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch
[EOF] [EOF]
@ -1051,8 +1050,8 @@ fn test_op_diff() {
// Diff from parent operation to latest operation. // Diff from parent operation to latest operation.
// `jj op diff --op @` should behave identically to `jj op diff --from // `jj op diff --op @` should behave identically to `jj op diff --from
// @- --to @` (if `@` is not a merge commit). // @- --to @` (if `@` is not a merge commit).
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--from", "@-", "--to", "@"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--from", "@-", "--to", "@"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 369ee2939177 (2001-02-03 08:05:07) fetch from git remote into empty repo From operation: 369ee2939177 (2001-02-03 08:05:07) fetch from git remote into empty repo
To operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch To operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch
@ -1071,12 +1070,12 @@ fn test_op_diff() {
- untracked pukowqtp 0cb7e07e bookmark-1 | Commit 1 - untracked pukowqtp 0cb7e07e bookmark-1 | Commit 1
[EOF] [EOF]
"); ");
let stdout_without_from_to = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output_without_from_to = test_env.run_jj_in(&repo_path, ["op", "diff"]).success();
assert_eq!(stdout.raw(), stdout_without_from_to.raw()); assert_eq!(output.stdout.raw(), output_without_from_to.stdout.raw());
// Diff from root operation to latest operation // Diff from root operation to latest operation
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--from", "0000000"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--from", "0000000"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 000000000000 root() From operation: 000000000000 root()
To operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch To operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch
@ -1105,8 +1104,8 @@ fn test_op_diff() {
"); ");
// Diff from latest operation to root operation // Diff from latest operation to root operation
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--to", "0000000"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--to", "0000000"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch From operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch
To operation: 000000000000 root() To operation: 000000000000 root()
@ -1152,8 +1151,8 @@ fn test_op_diff() {
Concurrent modification detected, resolving automatically. Concurrent modification detected, resolving automatically.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
@ 7f6887c5ae04 test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00 @ 7f6887c5ae04 test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
reconcile divergent operations reconcile divergent operations
args: jj log args: jj log
@ -1171,17 +1170,17 @@ fn test_op_diff() {
000000000000 root() 000000000000 root()
[EOF] [EOF]
"); ");
let op_log_lines = stdout.raw().lines().collect_vec(); let op_log_lines = output.stdout.raw().lines().collect_vec();
let op_id = op_log_lines[0].split(' ').nth(4).unwrap(); let op_id = op_log_lines[0].split(' ').nth(4).unwrap();
let first_parent_id = op_log_lines[3].split(' ').nth(3).unwrap(); let first_parent_id = op_log_lines[3].split(' ').nth(3).unwrap();
let second_parent_id = op_log_lines[6].split(' ').nth(3).unwrap(); let second_parent_id = op_log_lines[6].split(' ').nth(3).unwrap();
// Diff between the first parent of the merge operation and the merge operation. // Diff between the first parent of the merge operation and the merge operation.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["op", "diff", "--from", first_parent_id, "--to", op_id], ["op", "diff", "--from", first_parent_id, "--to", op_id],
); );
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch From operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch
To operation: 7f6887c5ae04 (2001-02-03 08:05:16) reconcile divergent operations To operation: 7f6887c5ae04 (2001-02-03 08:05:16) reconcile divergent operations
@ -1195,11 +1194,11 @@ fn test_op_diff() {
// Diff between the second parent of the merge operation and the merge // Diff between the second parent of the merge operation and the merge
// operation. // operation.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&["op", "diff", "--from", second_parent_id, "--to", op_id], ["op", "diff", "--from", second_parent_id, "--to", op_id],
); );
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: ee092a3adf88 (2001-02-03 08:05:15) point bookmark bookmark-1 to commit 4ff6253913375c6ebdddd8423c11df3b3f17e331 From operation: ee092a3adf88 (2001-02-03 08:05:15) point bookmark bookmark-1 to commit 4ff6253913375c6ebdddd8423c11df3b3f17e331
To operation: 7f6887c5ae04 (2001-02-03 08:05:16) reconcile divergent operations To operation: 7f6887c5ae04 (2001-02-03 08:05:16) reconcile divergent operations
@ -1232,8 +1231,8 @@ fn test_op_diff() {
Abandoned 1 commits that are no longer reachable. Abandoned 1 commits that are no longer reachable.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 7f6887c5ae04 (2001-02-03 08:05:16) reconcile divergent operations From operation: 7f6887c5ae04 (2001-02-03 08:05:16) reconcile divergent operations
To operation: 0fda9dbbc995 (2001-02-03 08:05:20) fetch from git remote(s) origin To operation: 0fda9dbbc995 (2001-02-03 08:05:20) fetch from git remote(s) origin
@ -1279,8 +1278,8 @@ fn test_op_diff() {
Created 1 bookmarks pointing to kulxwnxm e1a239a5 bookmark-2 bookmark-2@origin | Commit 5 Created 1 bookmarks pointing to kulxwnxm e1a239a5 bookmark-2 bookmark-2@origin | Commit 5
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 0fda9dbbc995 (2001-02-03 08:05:20) fetch from git remote(s) origin From operation: 0fda9dbbc995 (2001-02-03 08:05:20) fetch from git remote(s) origin
To operation: 505a09f5c0f0 (2001-02-03 08:05:22) create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af To operation: 505a09f5c0f0 (2001-02-03 08:05:22) create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af
@ -1300,8 +1299,8 @@ fn test_op_diff() {
Started tracking 1 remote bookmarks. Started tracking 1 remote bookmarks.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 505a09f5c0f0 (2001-02-03 08:05:22) create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af From operation: 505a09f5c0f0 (2001-02-03 08:05:22) create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af
To operation: e7d3f25689e1 (2001-02-03 08:05:24) track remote bookmark bookmark-2@origin To operation: e7d3f25689e1 (2001-02-03 08:05:24) track remote bookmark bookmark-2@origin
@ -1323,8 +1322,8 @@ fn test_op_diff() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 505a09f5c0f0 (2001-02-03 08:05:22) create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af From operation: 505a09f5c0f0 (2001-02-03 08:05:22) create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af
To operation: e7d3f25689e1 (2001-02-03 08:05:24) track remote bookmark bookmark-2@origin To operation: e7d3f25689e1 (2001-02-03 08:05:24) track remote bookmark bookmark-2@origin
@ -1348,8 +1347,8 @@ fn test_op_diff() {
Added 1 files, modified 0 files, removed 0 files Added 1 files, modified 0 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: e7d3f25689e1 (2001-02-03 08:05:24) track remote bookmark bookmark-2@origin From operation: e7d3f25689e1 (2001-02-03 08:05:24) track remote bookmark bookmark-2@origin
To operation: b94b5ef70c8a (2001-02-03 08:05:28) new empty commit To operation: b94b5ef70c8a (2001-02-03 08:05:28) new empty commit
@ -1368,8 +1367,8 @@ fn test_op_diff() {
Moved 1 bookmarks to wvuyspvk fefb1e17 bookmark-1* | (empty) new commit Moved 1 bookmarks to wvuyspvk fefb1e17 bookmark-1* | (empty) new commit
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: b94b5ef70c8a (2001-02-03 08:05:28) new empty commit From operation: b94b5ef70c8a (2001-02-03 08:05:28) new empty commit
To operation: 26918495eee5 (2001-02-03 08:05:30) point bookmark bookmark-1 to commit fefb1e17c85328767a596c6dc3d9d604c024a02c To operation: 26918495eee5 (2001-02-03 08:05:30) point bookmark bookmark-1 to commit fefb1e17c85328767a596c6dc3d9d604c024a02c
@ -1389,8 +1388,8 @@ fn test_op_diff() {
Deleted 1 bookmarks. Deleted 1 bookmarks.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 26918495eee5 (2001-02-03 08:05:30) point bookmark bookmark-1 to commit fefb1e17c85328767a596c6dc3d9d604c024a02c From operation: 26918495eee5 (2001-02-03 08:05:30) point bookmark bookmark-1 to commit fefb1e17c85328767a596c6dc3d9d604c024a02c
To operation: 9969a6088fd3 (2001-02-03 08:05:32) delete bookmark bookmark-2 To operation: 9969a6088fd3 (2001-02-03 08:05:32) delete bookmark bookmark-2
@ -1414,8 +1413,8 @@ fn test_op_diff() {
Parent commit : wvuyspvk fefb1e17 bookmark-1 | (empty) new commit Parent commit : wvuyspvk fefb1e17 bookmark-1 | (empty) new commit
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 9969a6088fd3 (2001-02-03 08:05:32) delete bookmark bookmark-2 From operation: 9969a6088fd3 (2001-02-03 08:05:32) delete bookmark bookmark-2
To operation: ff305cfe0aca (2001-02-03 08:05:34) push all tracked bookmarks to git remote origin To operation: ff305cfe0aca (2001-02-03 08:05:34) push all tracked bookmarks to git remote origin
@ -1448,8 +1447,8 @@ fn test_op_diff_patch() {
Parent commit : qpvuntsm 6b1027d2 (no description set) Parent commit : qpvuntsm 6b1027d2 (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--op", "@-", "-p", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--op", "@-", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default' From operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default'
To operation: 187a5a9d8a22 (2001-02-03 08:05:08) snapshot working copy To operation: 187a5a9d8a22 (2001-02-03 08:05:08) snapshot working copy
@ -1465,8 +1464,8 @@ fn test_op_diff_patch() {
+a +a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--op", "@", "-p", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--op", "@", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 187a5a9d8a22 (2001-02-03 08:05:08) snapshot working copy From operation: 187a5a9d8a22 (2001-02-03 08:05:08) snapshot working copy
To operation: a7e535e73c4b (2001-02-03 08:05:08) new empty commit To operation: a7e535e73c4b (2001-02-03 08:05:08) new empty commit
@ -1484,8 +1483,8 @@ fn test_op_diff_patch() {
Parent commit : qpvuntsm 2ac85fd1 (no description set) Parent commit : qpvuntsm 2ac85fd1 (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "-p", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 15c3c5d0baf0 (2001-02-03 08:05:11) snapshot working copy From operation: 15c3c5d0baf0 (2001-02-03 08:05:11) snapshot working copy
To operation: 894c12d90345 (2001-02-03 08:05:11) squash commits into 6b1027d2770cd0a39c468e525e52bf8c47e1464a To operation: 894c12d90345 (2001-02-03 08:05:11) squash commits into 6b1027d2770cd0a39c468e525e52bf8c47e1464a
@ -1520,8 +1519,8 @@ fn test_op_diff_patch() {
Parent commit : qpvuntsm 2ac85fd1 (no description set) Parent commit : qpvuntsm 2ac85fd1 (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "-p", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "diff", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 894c12d90345 (2001-02-03 08:05:11) squash commits into 6b1027d2770cd0a39c468e525e52bf8c47e1464a From operation: 894c12d90345 (2001-02-03 08:05:11) squash commits into 6b1027d2770cd0a39c468e525e52bf8c47e1464a
To operation: e5505aa79d31 (2001-02-03 08:05:13) abandon commit 9f4fb57fba25a7b47ce5980a5d9a4766778331e8 To operation: e5505aa79d31 (2001-02-03 08:05:13) abandon commit 9f4fb57fba25a7b47ce5980a5d9a4766778331e8
@ -1604,9 +1603,9 @@ fn test_op_diff_sibling() {
// Diff between p1 and p2 operations should work no matter if p2 is chosen // Diff between p1 and p2 operations should work no matter if p2 is chosen
// as a base operation. // as a base operation.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"op", "op",
"diff", "diff",
"--at-op", "--at-op",
@ -1618,7 +1617,7 @@ fn test_op_diff_sibling() {
"--summary", "--summary",
], ],
); );
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: d700dc16fded (2001-02-03 08:05:11) new empty commit From operation: d700dc16fded (2001-02-03 08:05:11) new empty commit
To operation: 13b143e1f4f9 (2001-02-03 08:05:12) describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 To operation: 13b143e1f4f9 (2001-02-03 08:05:12) describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
@ -1632,9 +1631,9 @@ fn test_op_diff_sibling() {
A file2 A file2
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"op", "op",
"diff", "diff",
"--at-op", "--at-op",
@ -1646,7 +1645,7 @@ fn test_op_diff_sibling() {
"--summary", "--summary",
], ],
); );
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
From operation: 13b143e1f4f9 (2001-02-03 08:05:12) describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 From operation: 13b143e1f4f9 (2001-02-03 08:05:12) describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
To operation: d700dc16fded (2001-02-03 08:05:11) new empty commit To operation: d700dc16fded (2001-02-03 08:05:11) new empty commit
@ -1806,8 +1805,8 @@ fn test_op_show() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
// Overview of op log. // Overview of op log.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
@ 364d0a677b0c test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 @ 364d0a677b0c test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
check out git remote's default branch check out git remote's default branch
args: jj git clone git-repo repo args: jj git clone git-repo repo
@ -1821,15 +1820,15 @@ fn test_op_show() {
"); ");
// The root operation is empty. // The root operation is empty.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "0000000"]); let output = test_env.run_jj_in(&repo_path, ["op", "show", "0000000"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
000000000000 root() 000000000000 root()
[EOF] [EOF]
"); ");
// Showing the latest operation. // Showing the latest operation.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "@"]); let output = test_env.run_jj_in(&repo_path, ["op", "show", "@"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
364d0a677b0c test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 364d0a677b0c test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
check out git remote's default branch check out git remote's default branch
args: jj git clone git-repo repo args: jj git clone git-repo repo
@ -1850,12 +1849,12 @@ fn test_op_show() {
[EOF] [EOF]
"); ");
// `jj op show @` should behave identically to `jj op show`. // `jj op show @` should behave identically to `jj op show`.
let stdout_without_op_id = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output_without_op_id = test_env.run_jj_in(&repo_path, ["op", "show"]).success();
assert_eq!(stdout.raw(), stdout_without_op_id.raw()); assert_eq!(output.stdout.raw(), output_without_op_id.stdout.raw());
// Showing a given operation. // Showing a given operation.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "@-"]); let output = test_env.run_jj_in(&repo_path, ["op", "show", "@-"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
369ee2939177 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 369ee2939177 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
fetch from git remote into empty repo fetch from git remote into empty repo
args: jj git clone git-repo repo args: jj git clone git-repo repo
@ -1897,8 +1896,8 @@ fn test_op_show() {
[EOF] [EOF]
"); ");
// Showing a merge operation is empty. // Showing a merge operation is empty.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
774687cc6e4e test-username@host.example.com 2001-02-03 04:05:14.000 +07:00 - 2001-02-03 04:05:14.000 +07:00 774687cc6e4e test-username@host.example.com 2001-02-03 04:05:14.000 +07:00 - 2001-02-03 04:05:14.000 +07:00
reconcile divergent operations reconcile divergent operations
args: jj log args: jj log
@ -1917,8 +1916,8 @@ fn test_op_show() {
Abandoned 1 commits that are no longer reachable. Abandoned 1 commits that are no longer reachable.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
fed3d4f59819 test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00 fed3d4f59819 test-username@host.example.com 2001-02-03 04:05:16.000 +07:00 - 2001-02-03 04:05:16.000 +07:00
fetch from git remote(s) origin fetch from git remote(s) origin
args: jj git fetch args: jj git fetch
@ -1965,8 +1964,8 @@ fn test_op_show() {
Created 1 bookmarks pointing to kulxwnxm e1a239a5 bookmark-2 bookmark-2@origin | Commit 5 Created 1 bookmarks pointing to kulxwnxm e1a239a5 bookmark-2 bookmark-2@origin | Commit 5
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
77ed6ae71f3f test-username@host.example.com 2001-02-03 04:05:18.000 +07:00 - 2001-02-03 04:05:18.000 +07:00 77ed6ae71f3f test-username@host.example.com 2001-02-03 04:05:18.000 +07:00 - 2001-02-03 04:05:18.000 +07:00
create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af
args: jj bookmark create bookmark-2 -r bookmark-2@origin args: jj bookmark create bookmark-2 -r bookmark-2@origin
@ -1987,8 +1986,8 @@ fn test_op_show() {
Started tracking 1 remote bookmarks. Started tracking 1 remote bookmarks.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
f4e770fd7370 test-username@host.example.com 2001-02-03 04:05:20.000 +07:00 - 2001-02-03 04:05:20.000 +07:00 f4e770fd7370 test-username@host.example.com 2001-02-03 04:05:20.000 +07:00 - 2001-02-03 04:05:20.000 +07:00
track remote bookmark bookmark-2@origin track remote bookmark bookmark-2@origin
args: jj bookmark track bookmark-2@origin args: jj bookmark track bookmark-2@origin
@ -2010,8 +2009,8 @@ fn test_op_show() {
Nothing changed. Nothing changed.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
f4e770fd7370 test-username@host.example.com 2001-02-03 04:05:20.000 +07:00 - 2001-02-03 04:05:20.000 +07:00 f4e770fd7370 test-username@host.example.com 2001-02-03 04:05:20.000 +07:00 - 2001-02-03 04:05:20.000 +07:00
track remote bookmark bookmark-2@origin track remote bookmark bookmark-2@origin
args: jj bookmark track bookmark-2@origin args: jj bookmark track bookmark-2@origin
@ -2036,8 +2035,8 @@ fn test_op_show() {
Added 1 files, modified 0 files, removed 0 files Added 1 files, modified 0 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
e54bb5012457 test-username@host.example.com 2001-02-03 04:05:24.000 +07:00 - 2001-02-03 04:05:24.000 +07:00 e54bb5012457 test-username@host.example.com 2001-02-03 04:05:24.000 +07:00 - 2001-02-03 04:05:24.000 +07:00
new empty commit new empty commit
args: jj new bookmark-1@origin -m 'new commit' args: jj new bookmark-1@origin -m 'new commit'
@ -2057,8 +2056,8 @@ fn test_op_show() {
Moved 1 bookmarks to xznxytkn 560df364 bookmark-1* | (empty) new commit Moved 1 bookmarks to xznxytkn 560df364 bookmark-1* | (empty) new commit
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
55527022d8b9 test-username@host.example.com 2001-02-03 04:05:26.000 +07:00 - 2001-02-03 04:05:26.000 +07:00 55527022d8b9 test-username@host.example.com 2001-02-03 04:05:26.000 +07:00 - 2001-02-03 04:05:26.000 +07:00
point bookmark bookmark-1 to commit 560df364f0a09fe29f6a4fca8bd07c4464c7feee point bookmark bookmark-1 to commit 560df364f0a09fe29f6a4fca8bd07c4464c7feee
args: jj bookmark set bookmark-1 -r @ args: jj bookmark set bookmark-1 -r @
@ -2079,8 +2078,8 @@ fn test_op_show() {
Deleted 1 bookmarks. Deleted 1 bookmarks.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
a6838035030b test-username@host.example.com 2001-02-03 04:05:28.000 +07:00 - 2001-02-03 04:05:28.000 +07:00 a6838035030b test-username@host.example.com 2001-02-03 04:05:28.000 +07:00 - 2001-02-03 04:05:28.000 +07:00
delete bookmark bookmark-2 delete bookmark bookmark-2
args: jj bookmark delete bookmark-2 args: jj bookmark delete bookmark-2
@ -2105,8 +2104,8 @@ fn test_op_show() {
Parent commit : xznxytkn 560df364 bookmark-1 | (empty) new commit Parent commit : xznxytkn 560df364 bookmark-1 | (empty) new commit
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]); let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
2a7821341a99 test-username@host.example.com 2001-02-03 04:05:30.000 +07:00 - 2001-02-03 04:05:30.000 +07:00 2a7821341a99 test-username@host.example.com 2001-02-03 04:05:30.000 +07:00 - 2001-02-03 04:05:30.000 +07:00
push all tracked bookmarks to git remote origin push all tracked bookmarks to git remote origin
args: jj git push --tracked args: jj git push --tracked
@ -2140,8 +2139,8 @@ fn test_op_show_patch() {
Parent commit : qpvuntsm 6b1027d2 (no description set) Parent commit : qpvuntsm 6b1027d2 (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "@-", "-p", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "show", "@-", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
187a5a9d8a22 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 187a5a9d8a22 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
snapshot working copy snapshot working copy
args: jj new args: jj new
@ -2158,8 +2157,8 @@ fn test_op_show_patch() {
+a +a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "@", "-p", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "show", "@", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
a7e535e73c4b test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 a7e535e73c4b test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
new empty commit new empty commit
args: jj new args: jj new
@ -2178,8 +2177,8 @@ fn test_op_show_patch() {
Parent commit : qpvuntsm 2ac85fd1 (no description set) Parent commit : qpvuntsm 2ac85fd1 (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "-p", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "show", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
894c12d90345 test-username@host.example.com 2001-02-03 04:05:11.000 +07:00 - 2001-02-03 04:05:11.000 +07:00 894c12d90345 test-username@host.example.com 2001-02-03 04:05:11.000 +07:00 - 2001-02-03 04:05:11.000 +07:00
squash commits into 6b1027d2770cd0a39c468e525e52bf8c47e1464a squash commits into 6b1027d2770cd0a39c468e525e52bf8c47e1464a
args: jj squash args: jj squash
@ -2215,8 +2214,8 @@ fn test_op_show_patch() {
Parent commit : qpvuntsm 2ac85fd1 (no description set) Parent commit : qpvuntsm 2ac85fd1 (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "-p", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "show", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
e5505aa79d31 test-username@host.example.com 2001-02-03 04:05:13.000 +07:00 - 2001-02-03 04:05:13.000 +07:00 e5505aa79d31 test-username@host.example.com 2001-02-03 04:05:13.000 +07:00 - 2001-02-03 04:05:13.000 +07:00
abandon commit 9f4fb57fba25a7b47ce5980a5d9a4766778331e8 abandon commit 9f4fb57fba25a7b47ce5980a5d9a4766778331e8
args: jj abandon args: jj abandon
@ -2228,8 +2227,8 @@ fn test_op_show_patch() {
"); ");
// Try again with "op log". // Try again with "op log".
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--git"]); let output = test_env.run_jj_in(&repo_path, ["op", "log", "--git"]);
insta::assert_snapshot!(&stdout, @r" insta::assert_snapshot!(output, @r"
@ e5505aa79d31 test-username@host.example.com 2001-02-03 04:05:13.000 +07:00 - 2001-02-03 04:05:13.000 +07:00 @ e5505aa79d31 test-username@host.example.com 2001-02-03 04:05:13.000 +07:00 - 2001-02-03 04:05:13.000 +07:00
abandon commit 9f4fb57fba25a7b47ce5980a5d9a4766778331e8 abandon commit 9f4fb57fba25a7b47ce5980a5d9a4766778331e8
args: jj abandon args: jj abandon

View File

@ -2811,7 +2811,7 @@ fn test_rebase_skip_emptied() {
let setup_opid = test_env.current_operation_id(&repo_path); let setup_opid = test_env.current_operation_id(&repo_path);
// Test the setup // Test the setup
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["log", "-T", "description"]), @r"
@ also already empty @ also already empty
already empty already empty
will become empty will become empty
@ -2834,7 +2834,7 @@ fn test_rebase_skip_emptied() {
// The parent commit became empty and was dropped, but the already empty commits // The parent commit became empty and was dropped, but the already empty commits
// were kept // were kept
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["log", "-T", "description"]), @r"
@ also already empty @ also already empty
already empty already empty
b b
@ -2845,7 +2845,7 @@ fn test_rebase_skip_emptied() {
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
// Test the setup // Test the setup
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["log", "-T", "description"]), @r"
@ also already empty @ also already empty
already empty already empty
will become empty will become empty
@ -2877,7 +2877,7 @@ fn test_rebase_skip_emptied() {
// Rebasing a single commit which becomes empty abandons that commit, whilst its // Rebasing a single commit which becomes empty abandons that commit, whilst its
// already empty descendants were kept // already empty descendants were kept
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["log", "-T", "description"]), @r"
@ also already empty @ also already empty
already empty already empty
b b
@ -2903,7 +2903,7 @@ fn test_rebase_skip_emptied_descendants() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "also already empty"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "also already empty"]);
// Test the setup // Test the setup
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["log", "-T", "description"]), @r"
@ also already empty @ also already empty
already empty already empty
c (will become empty) c (will become empty)
@ -2929,7 +2929,7 @@ fn test_rebase_skip_emptied_descendants() {
// Commits not in the rebase target set should not be abandoned even if they // Commits not in the rebase target set should not be abandoned even if they
// were emptied. // were emptied.
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["log", "-T", "description"]), @r"
@ also already empty @ also already empty
already empty already empty
c (will become empty) c (will become empty)

View File

@ -71,7 +71,7 @@ fn test_resolution() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -108,7 +108,7 @@ fn test_resolution() {
insta::assert_snapshot!( insta::assert_snapshot!(
std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###" std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###"
"###); "###);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
index 0000000000..88425ec521 100644 index 0000000000..88425ec521 100644
@ -152,7 +152,7 @@ fn test_resolution() {
Added 0 files, modified 1 files, removed 0 files Added 0 files, modified 1 files, removed 0 files
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
index 0000000000..88425ec521 100644 index 0000000000..88425ec521 100644
@ -179,7 +179,7 @@ fn test_resolution() {
// Check that the output file starts with conflict markers if // Check that the output file starts with conflict markers if
// `merge-tool-edits-conflict-markers=true` // `merge-tool-edits-conflict-markers=true`
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@""); @"");
std::fs::write( std::fs::write(
&editor_script, &editor_script,
@ -203,7 +203,7 @@ fn test_resolution() {
b b
>>>>>>> Conflict 1 of 1 ends >>>>>>> Conflict 1 of 1 ends
"###); "###);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
index 0000000000..88425ec521 100644 index 0000000000..88425ec521 100644
@ -224,7 +224,7 @@ fn test_resolution() {
// Check that if merge tool leaves conflict markers in output file and // Check that if merge tool leaves conflict markers in output file and
// `merge-tool-edits-conflict-markers=true`, these markers are properly parsed. // `merge-tool-edits-conflict-markers=true`, these markers are properly parsed.
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@""); @"");
std::fs::write( std::fs::write(
&editor_script, &editor_script,
@ -280,7 +280,7 @@ fn test_resolution() {
>>>>>>> Conflict 1 of 1 ends >>>>>>> Conflict 1 of 1 ends
"###); "###);
// Note the "Modified" below // Note the "Modified" below
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
--- a/file --- a/file
@ -298,7 +298,7 @@ fn test_resolution() {
>>>>>>> Conflict 1 of 1 ends >>>>>>> Conflict 1 of 1 ends
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -308,7 +308,7 @@ fn test_resolution() {
// `merge-tool-edits-conflict-markers=false` or is not specified, // `merge-tool-edits-conflict-markers=false` or is not specified,
// `jj` considers the conflict resolved. // `jj` considers the conflict resolved.
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@""); @"");
std::fs::write( std::fs::write(
&editor_script, &editor_script,
@ -342,7 +342,7 @@ fn test_resolution() {
std::fs::read_to_string(test_env.env_root().join("editor3")).unwrap(), @r###" std::fs::read_to_string(test_env.env_root().join("editor3")).unwrap(), @r###"
"###); "###);
// Note the "Resolved" below // Note the "Resolved" below
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
index 0000000000..0610716cc1 100644 index 0000000000..0610716cc1 100644
@ -375,7 +375,7 @@ fn test_resolution() {
// Check that merge tool can override conflict marker style setting, and that // Check that merge tool can override conflict marker style setting, and that
// the merge tool can output Git-style conflict markers // the merge tool can output Git-style conflict markers
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@""); @"");
std::fs::write( std::fs::write(
&editor_script, &editor_script,
@ -431,7 +431,7 @@ fn test_resolution() {
b b
>>>>>>> Side #2 (Conflict 1 of 1 ends) >>>>>>> Side #2 (Conflict 1 of 1 ends)
"##); "##);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
--- a/file --- a/file
@ -449,7 +449,7 @@ fn test_resolution() {
>>>>>>> Conflict 1 of 1 ends >>>>>>> Conflict 1 of 1 ends
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -459,7 +459,7 @@ fn test_resolution() {
// when using `merge-conflict-exit-codes = [1]`. The Git "diff3" conflict // when using `merge-conflict-exit-codes = [1]`. The Git "diff3" conflict
// markers should also be parsed correctly. // markers should also be parsed correctly.
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@""); @"");
std::fs::write( std::fs::write(
&editor_script, &editor_script,
@ -507,7 +507,7 @@ fn test_resolution() {
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
std::fs::read_to_string(test_env.env_root().join("editor5")).unwrap(), @""); std::fs::read_to_string(test_env.env_root().join("editor5")).unwrap(), @"");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
--- a/file --- a/file
@ -525,7 +525,7 @@ fn test_resolution() {
>>>>>>> Conflict 1 of 1 ends >>>>>>> Conflict 1 of 1 ends
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -534,7 +534,7 @@ fn test_resolution() {
// Check that an error is reported if a merge tool indicated it would leave // Check that an error is reported if a merge tool indicated it would leave
// conflict markers, but the output file didn't contain valid conflict markers. // conflict markers, but the output file didn't contain valid conflict markers.
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@""); @"");
std::fs::write( std::fs::write(
&editor_script, &editor_script,
@ -622,7 +622,7 @@ fn test_normal_conflict_input_files() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -665,7 +665,7 @@ fn test_baseless_conflict_input_files() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -697,13 +697,13 @@ fn test_too_many_parents() {
create_commit(&test_env, &repo_path, "b", &["base"], &[("file", "b\n")]); create_commit(&test_env, &repo_path, "b", &["base"], &[("file", "b\n")]);
create_commit(&test_env, &repo_path, "c", &["base"], &[("file", "c\n")]); create_commit(&test_env, &repo_path, "c", &["base"], &[("file", "c\n")]);
create_commit(&test_env, &repo_path, "conflict", &["a", "b", "c"], &[]); create_commit(&test_env, &repo_path, "conflict", &["a", "b", "c"], &[]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 3-sided conflict file 3-sided conflict
[EOF] [EOF]
"); ");
// Test warning color // Test warning color
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list", "--color=always"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list", "--color=always"]),
@r" @r"
file 3-sided conflict file 3-sided conflict
[EOF] [EOF]
@ -752,13 +752,13 @@ fn test_simplify_conflict_sides() {
// Even though the tree-level conflict is a 4-sided conflict, each file is // Even though the tree-level conflict is a 4-sided conflict, each file is
// materialized as a 2-sided conflict. // materialized as a 2-sided conflict.
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["debug", "tree"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["debug", "tree"]),
@r#" @r#"
fileA: Ok(Conflicted([Some(File { id: FileId("d00491fd7e5bb6fa28c517a0bb32b8b506539d4d"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("0cfbf08886fca9a91cb753ec8734c84fcbe52c9f"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false })])) fileA: Ok(Conflicted([Some(File { id: FileId("d00491fd7e5bb6fa28c517a0bb32b8b506539d4d"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("0cfbf08886fca9a91cb753ec8734c84fcbe52c9f"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false })]))
fileB: Ok(Conflicted([Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("d00491fd7e5bb6fa28c517a0bb32b8b506539d4d"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("0cfbf08886fca9a91cb753ec8734c84fcbe52c9f"), executable: false })])) fileB: Ok(Conflicted([Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("d00491fd7e5bb6fa28c517a0bb32b8b506539d4d"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("0cfbf08886fca9a91cb753ec8734c84fcbe52c9f"), executable: false })]))
[EOF] [EOF]
"#); "#);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
fileA 2-sided conflict fileA 2-sided conflict
fileB 2-sided conflict fileB 2-sided conflict
@ -846,7 +846,7 @@ fn test_simplify_conflict_sides() {
2_edited 2_edited
>>>>>>> Conflict 1 of 1 ends >>>>>>> Conflict 1 of 1 ends
"###); "###);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
fileA 2-sided conflict fileA 2-sided conflict
fileB 2-sided conflict fileB 2-sided conflict
@ -876,7 +876,7 @@ fn test_edit_delete_conflict_input_files() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict including 1 deletion file 2-sided conflict including 1 deletion
[EOF] [EOF]
@ -922,7 +922,7 @@ fn test_file_vs_dir() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict including a directory file 2-sided conflict including a directory
[EOF] [EOF]
@ -978,13 +978,13 @@ fn test_description_with_dir_and_deletion() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 3-sided conflict including 1 deletion and a directory file 3-sided conflict including 1 deletion and a directory
[EOF] [EOF]
"); ");
// Test warning color. The deletion is fine, so it's not highlighted // Test warning color. The deletion is fine, so it's not highlighted
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list", "--color=always"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list", "--color=always"]),
@r" @r"
file 3-sided conflict including 1 deletion and a directory file 3-sided conflict including 1 deletion and a directory
[EOF] [EOF]
@ -1038,7 +1038,7 @@ fn test_resolve_conflicts_with_executable() {
); );
test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "x", "file2"]); test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "x", "file2"]);
create_commit(&test_env, &repo_path, "conflict", &["a", "b"], &[]); create_commit(&test_env, &repo_path, "conflict", &["a", "b"], &[]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file1 2-sided conflict including an executable file1 2-sided conflict including an executable
file2 2-sided conflict including an executable file2 2-sided conflict including an executable
@ -1091,7 +1091,7 @@ fn test_resolve_conflicts_with_executable() {
Then run `jj squash` to move the resolution into the conflicted commit. Then run `jj squash` to move the resolution into the conflicted commit.
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 0000000000..95cc18629d 100755 index 0000000000..95cc18629d 100755
@ -1109,7 +1109,7 @@ fn test_resolve_conflicts_with_executable() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file2 2-sided conflict including an executable file2 2-sided conflict including an executable
[EOF] [EOF]
@ -1138,7 +1138,7 @@ fn test_resolve_conflicts_with_executable() {
Then run `jj squash` to move the resolution into the conflicted commit. Then run `jj squash` to move the resolution into the conflicted commit.
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file2 b/file2 diff --git a/file2 b/file2
index 0000000000..775f078581 100755 index 0000000000..775f078581 100755
@ -1156,7 +1156,7 @@ fn test_resolve_conflicts_with_executable() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file1 2-sided conflict including an executable file1 2-sided conflict including an executable
[EOF] [EOF]
@ -1196,7 +1196,7 @@ fn test_resolve_long_conflict_markers() {
&[("file", ">>>>>>> b\n")], &[("file", ">>>>>>> b\n")],
); );
create_commit(&test_env, &repo_path, "conflict", &["a", "b"], &[]); create_commit(&test_env, &repo_path, "conflict", &["a", "b"], &[]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -1255,7 +1255,7 @@ fn test_resolve_long_conflict_markers() {
Then run `jj squash` to move the resolution into the conflicted commit. Then run `jj squash` to move the resolution into the conflicted commit.
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
--- a/file --- a/file
@ -1280,7 +1280,7 @@ fn test_resolve_long_conflict_markers() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -1342,7 +1342,7 @@ fn test_resolve_long_conflict_markers() {
>>>>>>> b >>>>>>> b
>>>>>>>>>>> Conflict 1 of 1 ends >>>>>>>>>>> Conflict 1 of 1 ends
"##); "##);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
--- a/file --- a/file
@ -1362,7 +1362,7 @@ fn test_resolve_long_conflict_markers() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -1413,7 +1413,7 @@ fn test_resolve_long_conflict_markers() {
Then run `jj squash` to move the resolution into the conflicted commit. Then run `jj squash` to move the resolution into the conflicted commit.
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file b/file diff --git a/file b/file
--- a/file --- a/file
@ -1433,7 +1433,7 @@ fn test_resolve_long_conflict_markers() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
@ -1520,14 +1520,14 @@ fn test_multiple_conflicts() {
second b second b
>>>>>>> Conflict 1 of 1 ends >>>>>>> Conflict 1 of 1 ends
"###); "###);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
another_file 2-sided conflict another_file 2-sided conflict
this_file_has_a_very_long_name_to_test_padding 2-sided conflict this_file_has_a_very_long_name_to_test_padding 2-sided conflict
[EOF] [EOF]
"); ");
// Test colors // Test colors
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list", "--color=always"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list", "--color=always"]),
@r" @r"
another_file 2-sided conflict another_file 2-sided conflict
this_file_has_a_very_long_name_to_test_padding 2-sided conflict this_file_has_a_very_long_name_to_test_padding 2-sided conflict
@ -1557,7 +1557,7 @@ fn test_multiple_conflicts() {
Then run `jj squash` to move the resolution into the conflicted commit. Then run `jj squash` to move the resolution into the conflicted commit.
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/another_file b/another_file diff --git a/another_file b/another_file
index 0000000000..a9fcc7d486 100644 index 0000000000..a9fcc7d486 100644
@ -1574,7 +1574,7 @@ fn test_multiple_conflicts() {
+resolution another_file +resolution another_file
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
this_file_has_a_very_long_name_to_test_padding 2-sided conflict this_file_has_a_very_long_name_to_test_padding 2-sided conflict
[EOF] [EOF]
@ -1589,7 +1589,7 @@ fn test_multiple_conflicts() {
// Without a path, `jj resolve` should call the merge tool multiple times // Without a path, `jj resolve` should call the merge tool multiple times
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@""); @"");
std::fs::write( std::fs::write(
&editor_script, &editor_script,
@ -1604,7 +1604,7 @@ fn test_multiple_conflicts() {
) )
.unwrap(); .unwrap();
test_env.jj_cmd_ok(&repo_path, &["resolve"]); test_env.jj_cmd_ok(&repo_path, &["resolve"]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/another_file b/another_file diff --git a/another_file b/another_file
index 0000000000..7903e1c1c7 100644 index 0000000000..7903e1c1c7 100644
@ -1682,7 +1682,7 @@ fn test_multiple_conflicts_with_error() {
&[("file1", "b1\n"), ("file2", "b2\n")], &[("file1", "b1\n"), ("file2", "b2\n")],
); );
create_commit(&test_env, &repo_path, "conflict", &["a", "b"], &[]); create_commit(&test_env, &repo_path, "conflict", &["a", "b"], &[]);
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file1 2-sided conflict file1 2-sided conflict
file2 2-sided conflict file2 2-sided conflict
@ -1743,7 +1743,7 @@ fn test_multiple_conflicts_with_error() {
[EOF] [EOF]
[exit status: 1] [exit status: 1]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 0000000000..95cc18629d 100644 index 0000000000..95cc18629d 100644
@ -1761,7 +1761,7 @@ fn test_multiple_conflicts_with_error() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file2 2-sided conflict file2 2-sided conflict
[EOF] [EOF]
@ -1798,7 +1798,7 @@ fn test_multiple_conflicts_with_error() {
[EOF] [EOF]
[exit status: 1] [exit status: 1]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]),
@r" @r"
diff --git a/file1 b/file1 diff --git a/file1 b/file1
index 0000000000..95cc18629d 100644 index 0000000000..95cc18629d 100644
@ -1816,7 +1816,7 @@ fn test_multiple_conflicts_with_error() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file2 2-sided conflict file2 2-sided conflict
[EOF] [EOF]
@ -1835,9 +1835,9 @@ fn test_multiple_conflicts_with_error() {
[EOF] [EOF]
[exit status: 1] [exit status: 1]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), @""); insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]), @"");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]), test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r" @r"
file1 2-sided conflict file1 2-sided conflict
file2 2-sided conflict file2 2-sided conflict

View File

@ -52,13 +52,13 @@ fn test_restore() {
Added 1 files, modified 1 files, removed 1 files Added 1 files, modified 1 files, removed 1 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
// Can restore another revision from its parents // Can restore another revision from its parents
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r=@-"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r=@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A file2 A file2
[EOF] [EOF]
"); ");
@ -81,8 +81,8 @@ fn test_restore() {
Then run `jj squash` to move the resolution into the conflicted commit. Then run `jj squash` to move the resolution into the conflicted commit.
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r=@-"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r=@-"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
// Can restore this revision from another revision // Can restore this revision from another revision
test_env.jj_cmd_ok(&repo_path, &["undo"]); test_env.jj_cmd_ok(&repo_path, &["undo"]);
@ -95,8 +95,8 @@ fn test_restore() {
Added 1 files, modified 0 files, removed 2 files Added 1 files, modified 0 files, removed 2 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file2 D file2
[EOF] [EOF]
"); ");
@ -112,10 +112,10 @@ fn test_restore() {
Parent commit : rlvkpnrz ad805965 (no description set) Parent commit : rlvkpnrz ad805965 (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
A file2 A file2
A file3 A file3
@ -134,10 +134,10 @@ fn test_restore() {
Parent commit : rlvkpnrz f256040a (no description set) Parent commit : rlvkpnrz f256040a (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
A file2 A file2
A file3 A file3
@ -155,8 +155,8 @@ fn test_restore() {
Added 0 files, modified 1 files, removed 1 files Added 0 files, modified 1 files, removed 1 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
D file1 D file1
[EOF] [EOF]
"); ");
@ -198,7 +198,7 @@ fn test_restore_conflicted_merge() {
// Overwrite the file... // Overwrite the file...
std::fs::write(repo_path.join("file"), "resolution").unwrap(); std::fs::write(repo_path.join("file"), "resolution").unwrap();
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff"]),
@r" @r"
Resolved conflict in file: Resolved conflict in file:
1 : <<<<<<< Conflict 1 of 1 1 : <<<<<<< Conflict 1 of 1
@ -236,12 +236,12 @@ fn test_restore_conflicted_merge() {
b b
>>>>>>> Conflict 1 of 1 ends >>>>>>> Conflict 1 of 1 ends
"###); "###);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
// The same, but without the `file` argument. Overwrite the file... // The same, but without the `file` argument. Overwrite the file...
std::fs::write(repo_path.join("file"), "resolution").unwrap(); std::fs::write(repo_path.join("file"), "resolution").unwrap();
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff"]),
@r" @r"
Resolved conflict in file: Resolved conflict in file:
1 : <<<<<<< Conflict 1 of 1 1 : <<<<<<< Conflict 1 of 1
@ -337,7 +337,7 @@ fn test_restore_restore_descendants() {
// Check that "a", "b", and "ab" have their expected content by diffing them. // Check that "a", "b", and "ab" have their expected content by diffing them.
// "ab" must have kept its content. // "ab" must have kept its content.
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--from=a", "--to=ab", "--git"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--from=a", "--to=ab", "--git"]), @r"
diff --git a/file b/file diff --git a/file b/file
index 7898192261..81bf396956 100644 index 7898192261..81bf396956 100644
--- a/file --- a/file
@ -354,7 +354,7 @@ fn test_restore_restore_descendants() {
+b +b
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--from=b", "--to=ab", "--git"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--from=b", "--to=ab", "--git"]), @r"
diff --git a/file b/file diff --git a/file b/file
index df967b96a5..81bf396956 100644 index df967b96a5..81bf396956 100644
--- a/file --- a/file
@ -386,8 +386,8 @@ fn test_restore_interactive() {
&["a"], &["a"],
&[("file1", "b1\n"), ("file2", "b2\n"), ("file3", "b3\n")], &[("file1", "b1\n"), ("file2", "b2\n"), ("file3", "b3\n")],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:11 b c0745ce2 @ zsuskuln test.user@example.com 2001-02-03 08:05:11 b c0745ce2
b b
M file1 M file1
@ -430,8 +430,8 @@ fn test_restore_interactive() {
shows the contents you want for the destination commit. shows the contents you want for the destination commit.
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:13 b bccde490 @ zsuskuln test.user@example.com 2001-02-03 08:05:13 b bccde490
b b
M file2 M file2
@ -454,8 +454,8 @@ fn test_restore_interactive() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:16 b 5921de19 @ zsuskuln test.user@example.com 2001-02-03 08:05:16 b 5921de19
b b
M file2 M file2
@ -483,8 +483,8 @@ fn test_restore_interactive_merge() {
&["a", "b"], &["a", "b"],
&[("file1", "c1\n"), ("file2", "c2\n"), ("file3", "c3\n")], &[("file1", "c1\n"), ("file2", "c2\n"), ("file3", "c3\n")],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ royxmykx test.user@example.com 2001-02-03 08:05:13 c 34042291 @ royxmykx test.user@example.com 2001-02-03 08:05:13 c 34042291
c c
M file1 M file1
@ -531,8 +531,8 @@ fn test_restore_interactive_merge() {
shows the contents you want for the destination commit. shows the contents you want for the destination commit.
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ royxmykx test.user@example.com 2001-02-03 08:05:15 c 72e0cbf4 @ royxmykx test.user@example.com 2001-02-03 08:05:15 c 72e0cbf4
c c
M file2 M file2
@ -567,8 +567,8 @@ fn test_restore_interactive_with_paths() {
&["a"], &["a"],
&[("file1", "b1\n"), ("file2", "b2\n"), ("file3", "b3\n")], &[("file1", "b1\n"), ("file2", "b2\n"), ("file3", "b3\n")],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:11 b c0745ce2 @ zsuskuln test.user@example.com 2001-02-03 08:05:11 b c0745ce2
b b
M file1 M file1
@ -601,8 +601,8 @@ fn test_restore_interactive_with_paths() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]); let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:13 b 7187da33 @ zsuskuln test.user@example.com 2001-02-03 08:05:13 b 7187da33
b b
M file2 M file2

View File

@ -501,14 +501,14 @@ fn test_alias() {
"###, "###,
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "my-root"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "my-root"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
zzzzzzzz root() 00000000 zzzzzzzz root() 00000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "identity(my-root)"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "identity(my-root)"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
zzzzzzzz root() 00000000 zzzzzzzz root() 00000000
[EOF] [EOF]
"); ");
@ -739,8 +739,8 @@ fn test_all_modifier() {
"); ");
// Command that accepts multiple revisions by default // Command that accepts multiple revisions by default
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-rall:all()"]); let output = test_env.run_jj_in(&repo_path, ["log", "-rall:all()"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059 @ qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set) (empty) (no description set)
zzzzzzzz root() 00000000 zzzzzzzz root() 00000000
@ -765,8 +765,8 @@ fn test_all_modifier() {
"); ");
// Template expression that accepts multiple revisions by default // Template expression that accepts multiple revisions by default
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-Tself.contained_in('all:all()')"]); let output = test_env.run_jj_in(&repo_path, ["log", "-Tself.contained_in('all:all()')"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ true @ true
true true
[EOF] [EOF]

View File

@ -48,8 +48,8 @@ fn test_show_basic() {
std::fs::write(repo_path.join("file2"), "foo\nbar\nbaz quux\n").unwrap(); std::fs::write(repo_path.join("file2"), "foo\nbar\nbaz quux\n").unwrap();
std::fs::write(repo_path.join("file3"), "foo\n").unwrap(); std::fs::write(repo_path.join("file3"), "foo\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["show"]); let output = test_env.run_jj_in(&repo_path, ["show"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -65,8 +65,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--context=0"]); let output = test_env.run_jj_in(&repo_path, ["show", "--context=0"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -82,8 +82,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--color=debug"]); let output = test_env.run_jj_in(&repo_path, ["show", "--color=debug"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: <<commit_id::e34f04317a81edc6ba41fef239c0d0180f10656f>> Commit ID: <<commit_id::e34f04317a81edc6ba41fef239c0d0180f10656f>>
Change ID: <<change_id::rlvkpnrzqnoowoytxnquwvuryrwnrmlp>> Change ID: <<change_id::rlvkpnrzqnoowoytxnquwvuryrwnrmlp>>
Author : <<author name::Test User>> <<<author email local::test.user>><<author email::@>><<author email domain::example.com>>> (<<author timestamp local format::2001-02-03 08:05:09>>) Author : <<author name::Test User>> <<<author email local::test.user>><<author email::@>><<author email domain::example.com>>> (<<author timestamp local format::2001-02-03 08:05:09>>)
@ -99,8 +99,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-s"]); let output = test_env.run_jj_in(&repo_path, ["show", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -113,8 +113,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--types"]); let output = test_env.run_jj_in(&repo_path, ["show", "--types"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -127,8 +127,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--git"]); let output = test_env.run_jj_in(&repo_path, ["show", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -151,8 +151,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--git", "--context=0"]); let output = test_env.run_jj_in(&repo_path, ["show", "--git", "--context=0"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -174,8 +174,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--git", "--color=debug"]); let output = test_env.run_jj_in(&repo_path, ["show", "--git", "--color=debug"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: <<commit_id::e34f04317a81edc6ba41fef239c0d0180f10656f>> Commit ID: <<commit_id::e34f04317a81edc6ba41fef239c0d0180f10656f>>
Change ID: <<change_id::rlvkpnrzqnoowoytxnquwvuryrwnrmlp>> Change ID: <<change_id::rlvkpnrzqnoowoytxnquwvuryrwnrmlp>>
Author : <<author name::Test User>> <<<author email local::test.user>><<author email::@>><<author email domain::example.com>>> (<<author timestamp local format::2001-02-03 08:05:09>>) Author : <<author name::Test User>> <<<author email local::test.user>><<author email::@>><<author email domain::example.com>>> (<<author timestamp local format::2001-02-03 08:05:09>>)
@ -198,8 +198,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-s", "--git"]); let output = test_env.run_jj_in(&repo_path, ["show", "-s", "--git"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -224,8 +224,8 @@ fn test_show_basic() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--stat"]); let output = test_env.run_jj_in(&repo_path, ["show", "--stat"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09) Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -247,9 +247,9 @@ fn test_show_with_template() {
let repo_path = test_env.env_root().join("repo"); let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "a new commit"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "a new commit"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["show", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a new commit a new commit
[EOF] [EOF]
"); ");

View File

@ -75,8 +75,8 @@ fn test_simplify_parents_no_change() {
create_commit(&test_env, &repo_path, "a", &["root()"]); create_commit(&test_env, &repo_path, "a", &["root()"]);
create_commit(&test_env, &repo_path, "b", &["a"]); create_commit(&test_env, &repo_path, "b", &["a"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ b @ b
a a
@ -90,8 +90,8 @@ fn test_simplify_parents_no_change() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ b @ b
a a
@ -107,8 +107,8 @@ fn test_simplify_parents_no_change_diamond() {
create_commit(&test_env, &repo_path, "b", &["a"]); create_commit(&test_env, &repo_path, "b", &["a"]);
create_commit(&test_env, &repo_path, "c", &["a"]); create_commit(&test_env, &repo_path, "c", &["a"]);
create_commit(&test_env, &repo_path, "d", &["b", "c"]); create_commit(&test_env, &repo_path, "d", &["b", "c"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ d @ d
c c
@ -127,8 +127,8 @@ fn test_simplify_parents_no_change_diamond() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ d @ d
c c
@ -148,9 +148,9 @@ fn test_simplify_parents_redundant_parent(args: &[&str]) {
create_commit(&test_env, &repo_path, "a", &["root()"]); create_commit(&test_env, &repo_path, "a", &["root()"]);
create_commit(&test_env, &repo_path, "b", &["a"]); create_commit(&test_env, &repo_path, "b", &["a"]);
create_commit(&test_env, &repo_path, "c", &["a", "b"]); create_commit(&test_env, &repo_path, "c", &["a", "b"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ c @ c
b b
@ -173,9 +173,9 @@ fn test_simplify_parents_redundant_parent(args: &[&str]) {
"); ");
} }
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ c @ c
b b
a a
@ -195,8 +195,8 @@ fn test_simplify_parents_multiple_redundant_parents() {
create_commit(&test_env, &repo_path, "d", &["c"]); create_commit(&test_env, &repo_path, "d", &["c"]);
create_commit(&test_env, &repo_path, "e", &["d"]); create_commit(&test_env, &repo_path, "e", &["d"]);
create_commit(&test_env, &repo_path, "f", &["d", "e"]); create_commit(&test_env, &repo_path, "f", &["d", "e"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ f @ f
e e
@ -224,8 +224,8 @@ fn test_simplify_parents_multiple_redundant_parents() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ f @ f
e e
d d
@ -248,8 +248,8 @@ fn test_simplify_parents_multiple_redundant_parents() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ f @ f
e e
d d
@ -271,8 +271,8 @@ fn test_simplify_parents_no_args() {
create_commit(&test_env, &repo_path, "d", &["c"]); create_commit(&test_env, &repo_path, "d", &["c"]);
create_commit(&test_env, &repo_path, "e", &["d"]); create_commit(&test_env, &repo_path, "e", &["d"]);
create_commit(&test_env, &repo_path, "f", &["d", "e"]); create_commit(&test_env, &repo_path, "f", &["d", "e"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ f @ f
e e
@ -298,8 +298,8 @@ fn test_simplify_parents_no_args() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ f @ f
e e
d d
@ -322,8 +322,8 @@ fn test_simplify_parents_no_args() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ f @ f
e e
d d

View File

@ -30,8 +30,8 @@ fn test_sparse_manage_patterns() {
std::fs::write(repo_path.join("file3"), "contents").unwrap(); std::fs::write(repo_path.join("file3"), "contents").unwrap();
// By default, all files are tracked // By default, all files are tracked
let stdout = test_env.jj_cmd_success(&repo_path, &["sparse", "list"]); let output = test_env.run_jj_in(&repo_path, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
. .
[EOF] [EOF]
"); ");
@ -44,15 +44,15 @@ fn test_sparse_manage_patterns() {
[EOF] [EOF]
"); ");
// The list is now empty // The list is now empty
let stdout = test_env.jj_cmd_success(&repo_path, &["sparse", "list"]); let output = test_env.run_jj_in(&repo_path, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
// They're removed from the working copy // They're removed from the working copy
assert!(!repo_path.join("file1").exists()); assert!(!repo_path.join("file1").exists());
assert!(!repo_path.join("file2").exists()); assert!(!repo_path.join("file2").exists());
assert!(!repo_path.join("file3").exists()); assert!(!repo_path.join("file3").exists());
// But they're still in the commit // But they're still in the commit
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 file1
file2 file2
file3 file3
@ -85,8 +85,8 @@ fn test_sparse_manage_patterns() {
Added 2 files, modified 0 files, removed 0 files Added 2 files, modified 0 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&sub_dir, &["sparse", "list"]); let output = test_env.run_jj_in(&sub_dir, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file2 file2
file3 file3
[EOF] [EOF]
@ -107,8 +107,8 @@ fn test_sparse_manage_patterns() {
Added 1 files, modified 0 files, removed 2 files Added 1 files, modified 0 files, removed 2 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&sub_dir, &["sparse", "list"]); let output = test_env.run_jj_in(&sub_dir, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 file1
[EOF] [EOF]
"); ");
@ -124,8 +124,8 @@ fn test_sparse_manage_patterns() {
Added 1 files, modified 0 files, removed 1 files Added 1 files, modified 0 files, removed 1 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&sub_dir, &["sparse", "list"]); let output = test_env.run_jj_in(&sub_dir, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file2 file2
[EOF] [EOF]
"); ");
@ -140,8 +140,8 @@ fn test_sparse_manage_patterns() {
Added 2 files, modified 0 files, removed 0 files Added 2 files, modified 0 files, removed 0 files
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&sub_dir, &["sparse", "list"]); let output = test_env.run_jj_in(&sub_dir, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
. .
[EOF] [EOF]
"); ");
@ -168,8 +168,8 @@ fn test_sparse_manage_patterns() {
[EOF] [EOF]
"); ");
insta::assert_snapshot!(read_patterns(), @"."); insta::assert_snapshot!(read_patterns(), @".");
let stdout = test_env.jj_cmd_success(&sub_dir, &["sparse", "list"]); let output = test_env.run_jj_in(&sub_dir, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file1 file1
[EOF] [EOF]
"); ");
@ -185,8 +185,8 @@ fn test_sparse_manage_patterns() {
insta::assert_snapshot!(read_patterns(), @r###" insta::assert_snapshot!(read_patterns(), @r###"
file1 file1
"###); "###);
let stdout = test_env.jj_cmd_success(&sub_dir, &["sparse", "list"]); let output = test_env.run_jj_in(&sub_dir, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
file2 file2
file3 file3
[EOF] [EOF]

View File

@ -102,13 +102,13 @@ fn test_split_by_paths() {
Committer date: 2001-02-03 04:05:10.000 +07:00[EOF] Committer date: 2001-02-03 04:05:10.000 +07:00[EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A file2 A file2
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A file1 A file1
A file3 A file3
[EOF] [EOF]
@ -136,8 +136,8 @@ fn test_split_by_paths() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@--"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@--"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A file2 A file2
[EOF] [EOF]
"); ");
@ -167,8 +167,8 @@ fn test_split_by_paths() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]); let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
A file2 A file2
[EOF] [EOF]
"); ");
@ -639,8 +639,8 @@ fn test_split_interactive() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&workspace_path, &["log", "--summary"]); let output = test_env.run_jj_in(&workspace_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:08 9ed12e4c @ rlvkpnrz test.user@example.com 2001-02-03 08:05:08 9ed12e4c
(no description set) (no description set)
A file2 A file2
@ -696,8 +696,8 @@ fn test_split_interactive_with_paths() {
JJ: Lines starting with "JJ:" (like this one) will be removed. JJ: Lines starting with "JJ:" (like this one) will be removed.
"###); "###);
let stdout = test_env.jj_cmd_success(&workspace_path, &["log", "--summary"]); let output = test_env.run_jj_in(&workspace_path, ["log", "--summary"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ kkmpptxz test.user@example.com 2001-02-03 08:05:09 4cf22d3b @ kkmpptxz test.user@example.com 2001-02-03 08:05:09 4cf22d3b
(no description set) (no description set)
M file2 M file2

View File

@ -56,8 +56,8 @@ fn test_squash() {
000000000000 (empty) 000000000000 (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
@ -78,13 +78,13 @@ fn test_squash() {
000000000000 (empty) 000000000000 (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
@ -140,8 +140,8 @@ fn test_squash() {
000000000000 (empty) 000000000000 (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "e"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "e"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
e e
[EOF] [EOF]
"); ");
@ -206,8 +206,8 @@ fn test_squash_partial() {
000000000000 (empty) 000000000000 (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
@ -230,23 +230,23 @@ fn test_squash_partial() {
000000000000 (empty) 000000000000 (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
@ -270,23 +270,23 @@ fn test_squash_partial() {
000000000000 (empty) 000000000000 (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
@ -351,8 +351,8 @@ fn test_squash_keep_emptied() {
000000000000 (empty) 000000000000 (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
@ -437,14 +437,14 @@ fn test_squash_from_to() {
[EOF] [EOF]
"); ");
// The change from the source has been applied // The change from the source has been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
// File `file2`, which was not changed in source, is unchanged // File `file2`, which was not changed in source, is unchanged
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
f f
[EOF] [EOF]
"); ");
@ -472,8 +472,8 @@ fn test_squash_from_to() {
"); ");
// The change from the source has been applied (the file contents were already // The change from the source has been applied (the file contents were already
// "f", as is typically the case when moving changes from an ancestor) // "f", as is typically the case when moving changes from an ancestor)
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
f f
[EOF] [EOF]
"); ");
@ -502,8 +502,8 @@ fn test_squash_from_to() {
[EOF] [EOF]
"); ");
// The change from the source has been applied // The change from the source has been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "d"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "d"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
e e
[EOF] [EOF]
"); ");
@ -567,19 +567,19 @@ fn test_squash_from_to_partial() {
[EOF] [EOF]
"); ");
// The changes from the source has been applied // The changes from the source has been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
// File `file3`, which was not changed in source, is unchanged // File `file3`, which was not changed in source, is unchanged
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file3"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file3"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
d d
[EOF] [EOF]
"); ");
@ -605,20 +605,20 @@ fn test_squash_from_to_partial() {
[EOF] [EOF]
"); ");
// The selected change from the source has been applied // The selected change from the source has been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
// The unselected change from the source has not been applied // The unselected change from the source has not been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
// File `file3`, which was changed in source's parent, is unchanged // File `file3`, which was changed in source's parent, is unchanged
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file3"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file3"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
d d
[EOF] [EOF]
"); ");
@ -645,20 +645,20 @@ fn test_squash_from_to_partial() {
[EOF] [EOF]
"); ");
// The selected change from the source has been applied // The selected change from the source has been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
// The unselected change from the source has not been applied // The unselected change from the source has not been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
// File `file3`, which was changed in source's parent, is unchanged // File `file3`, which was changed in source's parent, is unchanged
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file3"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file3"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
d d
[EOF] [EOF]
"); ");
@ -686,14 +686,14 @@ fn test_squash_from_to_partial() {
[EOF] [EOF]
"); ");
// The selected change from the source has been applied // The selected change from the source has been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
// The unselected change from the source has not been applied // The unselected change from the source has not been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
@ -784,8 +784,8 @@ fn test_squash_from_multiple() {
[EOF] [EOF]
"); ");
// The changes from the sources have been applied // The changes from the sources have been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=d", "file"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=d", "file"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
%%%%%%% Changes from base #1 to side #1 %%%%%%% Changes from base #1 to side #1
-a -a
@ -820,8 +820,8 @@ fn test_squash_from_multiple() {
[EOF] [EOF]
"); ");
// The changes from the sources have been applied to the destination // The changes from the sources have been applied to the destination
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=e", "file"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=e", "file"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
f f
[EOF] [EOF]
"); ");
@ -920,19 +920,19 @@ fn test_squash_from_multiple_partial() {
[EOF] [EOF]
"); ");
// The selected changes have been removed from the sources // The selected changes have been removed from the sources
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=b", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=b", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=c", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=c", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
// The selected changes from the sources have been applied // The selected changes from the sources have been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=d", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=d", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
<<<<<<< Conflict 1 of 1 <<<<<<< Conflict 1 of 1
%%%%%%% Changes from base #1 to side #1 %%%%%%% Changes from base #1 to side #1
-a -a
@ -947,8 +947,8 @@ fn test_squash_from_multiple_partial() {
"); ");
// The unselected change from the sources have not been applied to the // The unselected change from the sources have not been applied to the
// destination // destination
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=d", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=d", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
d d
[EOF] [EOF]
"); ");
@ -978,30 +978,30 @@ fn test_squash_from_multiple_partial() {
[EOF] [EOF]
"); ");
// The selected changes have been removed from the sources // The selected changes have been removed from the sources
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=b", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=b", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=c", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=c", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=f", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=f", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
f f
[EOF] [EOF]
"); ");
// The selected changes from the sources have been applied to the destination // The selected changes from the sources have been applied to the destination
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=e", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=e", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
f f
[EOF] [EOF]
"); ");
// The unselected changes from the sources have not been applied // The unselected changes from the sources have not been applied
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=d", "file2"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=d", "file2"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
d d
[EOF] [EOF]
"); ");
@ -1061,15 +1061,15 @@ fn test_squash_from_multiple_partial_no_op() {
000000000000 (empty) 000000000000 (empty)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"evolog", "evolog",
"-T", "-T",
r#"separate(" ", commit_id.short(), description)"#, r#"separate(" ", commit_id.short(), description)"#,
], ],
); );
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ e178068add8c d @ e178068add8c d
b73077b08c59 b b73077b08c59 b

View File

@ -64,8 +64,8 @@ fn test_status_copies() {
std::fs::remove_file(repo_path.join("rename-source")).unwrap(); std::fs::remove_file(repo_path.join("rename-source")).unwrap();
std::fs::write(repo_path.join("rename-target"), "rename").unwrap(); std::fs::write(repo_path.join("rename-target"), "rename").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
M copy-source M copy-source
C {copy-source => copy-target} C {copy-source => copy-target}
@ -91,8 +91,8 @@ fn test_status_merge() {
// The output should mention each parent, and the diff should be empty (compared // The output should mention each parent, and the diff should be empty (compared
// to the auto-merged parents) // to the auto-merged parents)
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
The working copy has no changes. The working copy has no changes.
Working copy : mzvwutvl a538c72d (empty) (no description set) Working copy : mzvwutvl a538c72d (empty) (no description set)
Parent commit: rlvkpnrz d3dd19f1 left | (empty) left Parent commit: rlvkpnrz d3dd19f1 left | (empty) left
@ -117,8 +117,8 @@ fn test_status_ignored_gitignore() {
.unwrap(); .unwrap();
std::fs::write(repo_path.join(".gitignore"), "untracked/\n!dummy\n").unwrap(); std::fs::write(repo_path.join(".gitignore"), "untracked/\n!dummy\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
A .gitignore A .gitignore
Working copy : qpvuntsm 3cef2183 (no description set) Working copy : qpvuntsm 3cef2183 (no description set)
@ -137,8 +137,8 @@ fn test_status_filtered() {
std::fs::write(repo_path.join("file_2"), "file_2").unwrap(); std::fs::write(repo_path.join("file_2"), "file_2").unwrap();
// The output filtered to file_1 should not list the addition of file_2. // The output filtered to file_1 should not list the addition of file_2.
let stdout = test_env.jj_cmd_success(&repo_path, &["status", "file_1"]); let output = test_env.run_jj_in(&repo_path, ["status", "file_1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
A file_1 A file_1
Working copy : qpvuntsm c8fb8395 (no description set) Working copy : qpvuntsm c8fb8395 (no description set)
@ -187,9 +187,9 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
test_env.jj_cmd_ok(&repo_path, &["new", "--message", "boom-cont"]); test_env.jj_cmd_ok(&repo_path, &["new", "--message", "boom-cont"]);
test_env.jj_cmd_ok(&repo_path, &["new", "--message", "boom-cont-2"]); test_env.jj_cmd_ok(&repo_path, &["new", "--message", "boom-cont-2"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "::"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "::"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ yqosqzyt test.user@example.com 2001-02-03 08:05:13 dcb25635 conflict @ yqosqzyt test.user@example.com 2001-02-03 08:05:13 dcb25635 conflict
(empty) boom-cont-2 (empty) boom-cont-2
× royxmykx test.user@example.com 2001-02-03 08:05:12 664a4c6c conflict × royxmykx test.user@example.com 2001-02-03 08:05:12 664a4c6c conflict
@ -206,8 +206,8 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
The working copy has no changes. The working copy has no changes.
Working copy : yqosqzyt dcb25635 (conflict) (empty) boom-cont-2 Working copy : yqosqzyt dcb25635 (conflict) (empty) boom-cont-2
Parent commit: royxmykx 664a4c6c (conflict) (empty) boom-cont Parent commit: royxmykx 664a4c6c (conflict) (empty) boom-cont
@ -221,8 +221,8 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["status", "--color=always"]); let output = test_env.run_jj_in(&repo_path, ["status", "--color=always"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
The working copy has no changes. The working copy has no changes.
Working copy : yqosqzyt dcb25635 (conflict) (empty) boom-cont-2 Working copy : yqosqzyt dcb25635 (conflict) (empty) boom-cont-2
Parent commit: royxmykx 664a4c6c (conflict) (empty) boom-cont Parent commit: royxmykx 664a4c6c (conflict) (empty) boom-cont
@ -245,9 +245,9 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
std::fs::write(&conflicted_path, "edit not conflict").unwrap(); std::fs::write(&conflicted_path, "edit not conflict").unwrap();
// wc is now conflict free, parent is also conflict free // wc is now conflict free, parent is also conflict free
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "::"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "::"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ kmkuslsw test.user@example.com 2001-02-03 08:05:19 caa7e9d5 @ kmkuslsw test.user@example.com 2001-02-03 08:05:19 caa7e9d5
fixed 2 fixed 2
kpqxywon test.user@example.com 2001-02-03 08:05:18 26bf6863 kpqxywon test.user@example.com 2001-02-03 08:05:18 26bf6863
@ -268,9 +268,9 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
M conflicted.txt M conflicted.txt
Working copy : kmkuslsw caa7e9d5 fixed 2 Working copy : kmkuslsw caa7e9d5 fixed 2
@ -281,9 +281,9 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
// Step back one. // Step back one.
// wc is still conflict free, parent has a conflict. // wc is still conflict free, parent has a conflict.
test_env.jj_cmd_ok(&repo_path, &["edit", "@-"]); test_env.jj_cmd_ok(&repo_path, &["edit", "@-"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "::"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "::"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
kmkuslsw test.user@example.com 2001-02-03 08:05:19 caa7e9d5 kmkuslsw test.user@example.com 2001-02-03 08:05:19 caa7e9d5
fixed 2 fixed 2
@ kpqxywon test.user@example.com 2001-02-03 08:05:18 26bf6863 @ kpqxywon test.user@example.com 2001-02-03 08:05:18 26bf6863
@ -304,9 +304,9 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
M conflicted.txt M conflicted.txt
Working copy : kpqxywon 26bf6863 fixed 1 Working copy : kpqxywon 26bf6863 fixed 1
@ -319,9 +319,9 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
// there is a conflict later in the tree. So that we can confirm // there is a conflict later in the tree. So that we can confirm
// our hinting logic doesn't get confused. // our hinting logic doesn't get confused.
test_env.jj_cmd_ok(&repo_path, &["edit", "root()+"]); test_env.jj_cmd_ok(&repo_path, &["edit", "root()+"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "::"]); let output = test_env.run_jj_in(&repo_path, ["log", "-r", "::"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
kmkuslsw test.user@example.com 2001-02-03 08:05:19 caa7e9d5 kmkuslsw test.user@example.com 2001-02-03 08:05:19 caa7e9d5
fixed 2 fixed 2
kpqxywon test.user@example.com 2001-02-03 08:05:18 26bf6863 kpqxywon test.user@example.com 2001-02-03 08:05:18 26bf6863
@ -342,9 +342,9 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
A conflicted.txt A conflicted.txt
Working copy : qpvuntsm aade7195 Initial contents Working copy : qpvuntsm aade7195 Initial contents
@ -383,7 +383,7 @@ fn test_status_simplify_conflict_sides() {
&[], &[],
); );
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["status"]), insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["status"]),
@r" @r"
The working copy has no changes. The working copy has no changes.
Working copy : nkmrtpmo 83c4b9e7 conflict | (conflict) (empty) conflict Working copy : nkmrtpmo 83c4b9e7 conflict | (conflict) (empty) conflict
@ -416,8 +416,8 @@ fn test_status_untracked_files() {
std::fs::write(repo_path.join("sub").join("always-untracked"), "...").unwrap(); std::fs::write(repo_path.join("sub").join("always-untracked"), "...").unwrap();
std::fs::write(repo_path.join("sub").join("initially-untracked"), "...").unwrap(); std::fs::write(repo_path.join("sub").join("initially-untracked"), "...").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
Untracked paths: Untracked paths:
? always-untracked-file ? always-untracked-file
? initially-untracked-file ? initially-untracked-file
@ -438,8 +438,8 @@ fn test_status_untracked_files() {
], ],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
Working copy changes: Working copy changes:
A initially-untracked-file A initially-untracked-file
A sub/initially-untracked A sub/initially-untracked
@ -453,8 +453,8 @@ fn test_status_untracked_files() {
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
Untracked paths: Untracked paths:
? always-untracked-file ? always-untracked-file
? sub/always-untracked ? sub/always-untracked
@ -472,8 +472,8 @@ fn test_status_untracked_files() {
"sub/initially-untracked", "sub/initially-untracked",
], ],
); );
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
Working copy changes: Working copy changes:
D initially-untracked-file D initially-untracked-file
D sub/initially-untracked D sub/initially-untracked
@ -489,8 +489,8 @@ fn test_status_untracked_files() {
test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]); let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
Untracked paths: Untracked paths:
? always-untracked-file ? always-untracked-file
? initially-untracked-file ? initially-untracked-file

View File

@ -57,7 +57,7 @@ fn test_tag_list() {
test_env.jj_cmd_ok(&repo_path, &["status"]); // resolve concurrent ops test_env.jj_cmd_ok(&repo_path, &["status"]); // resolve concurrent ops
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["tag", "list"]), test_env.run_jj_in(&repo_path, ["tag", "list"]),
@r" @r"
conflicted_tag (conflicted): conflicted_tag (conflicted):
- rlvkpnrz caf975d0 (empty) commit1 - rlvkpnrz caf975d0 (empty) commit1
@ -69,7 +69,7 @@ fn test_tag_list() {
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["tag", "list", "--color=always"]), test_env.run_jj_in(&repo_path, ["tag", "list", "--color=always"]),
@r" @r"
conflicted_tag (conflicted): conflicted_tag (conflicted):
- rlvkpnrz caf975d0 (empty) commit1 - rlvkpnrz caf975d0 (empty) commit1
@ -82,14 +82,14 @@ fn test_tag_list() {
// Test pattern matching. // Test pattern matching.
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["tag", "list", "test_tag2"]), test_env.run_jj_in(&repo_path, ["tag", "list", "test_tag2"]),
@r" @r"
test_tag2: zsuskuln 3db783e0 (empty) commit2 test_tag2: zsuskuln 3db783e0 (empty) commit2
[EOF] [EOF]
"); ");
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["tag", "list", "glob:test_tag?"]), test_env.run_jj_in(&repo_path, ["tag", "list", "glob:test_tag?"]),
@r" @r"
test_tag2: zsuskuln 3db783e0 (empty) commit2 test_tag2: zsuskuln 3db783e0 (empty) commit2
[EOF] [EOF]
@ -106,7 +106,7 @@ fn test_tag_list() {
) )
"#; "#;
insta::assert_snapshot!( insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["tag", "list", "-T", template]), test_env.run_jj_in(&repo_path, ["tag", "list", "-T", template]),
@r" @r"
[conflicted_tag] [conflicted_tag]
present: true present: true

View File

@ -488,9 +488,9 @@ fn test_templater_alias_override() {
// 'f(x)' should be overridden by --config 'f(a)'. If aliases were sorted // 'f(x)' should be overridden by --config 'f(a)'. If aliases were sorted
// purely by name, 'f(a)' would come first. // purely by name, 'f(a)' would come first.
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&repo_path, &repo_path,
&[ [
"log", "log",
"--no-graph", "--no-graph",
"-r@", "-r@",
@ -499,7 +499,7 @@ fn test_templater_alias_override() {
r#"--config=template-aliases.'f(a)'='"arg"'"#, r#"--config=template-aliases.'f(a)'='"arg"'"#,
], ],
); );
insta::assert_snapshot!(stdout, @"arg[EOF]"); insta::assert_snapshot!(output, @"arg[EOF]");
} }
#[test] #[test]

View File

@ -31,8 +31,8 @@ fn test_undo_rewrite_with_child() {
let output = test_env.run_jj_in(&repo_path, ["op", "log"]).success(); let output = test_env.run_jj_in(&repo_path, ["op", "log"]).success();
let op_id_hex = output.stdout.raw()[3..15].to_string(); let op_id_hex = output.stdout.raw()[3..15].to_string();
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "child"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m", "child"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ child @ child
modified modified
@ -42,8 +42,8 @@ fn test_undo_rewrite_with_child() {
// Since we undid the description-change, the child commit should now be on top // Since we undid the description-change, the child commit should now be on top
// of the initial commit // of the initial commit
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]); let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ child @ child
initial initial

View File

@ -57,8 +57,8 @@ fn test_unsquash() {
000000000000 000000000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
@ -81,13 +81,13 @@ fn test_unsquash() {
000000000000 a 000000000000 a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
@ -146,8 +146,8 @@ fn test_unsquash() {
000000000000 000000000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
e e
[EOF] [EOF]
"); ");
@ -214,8 +214,8 @@ fn test_unsquash_partial() {
000000000000 000000000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "a"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "a"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
@ -239,23 +239,23 @@ fn test_unsquash_partial() {
000000000000 000000000000
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "c"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "c"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "c"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "c"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
@ -278,23 +278,23 @@ fn test_unsquash_partial() {
Parent commit : kkmpptxz fe8eb117 b | (no description set) Parent commit : kkmpptxz fe8eb117 b | (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
a a
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "b"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "b"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
b b
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "c"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "c"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2", "-r", "c"]); let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2", "-r", "c"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
c c
[EOF] [EOF]
"); ");

View File

@ -19,10 +19,10 @@ use crate::common::TestEnvironment;
#[test] #[test]
fn test_util_config_schema() { fn test_util_config_schema() {
let test_env = TestEnvironment::default(); let test_env = TestEnvironment::default();
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["util", "config-schema"]); let output = test_env.run_jj_in(test_env.env_root(), ["util", "config-schema"]);
// Validate partial snapshot, redacting any lines nested 2+ indent levels. // Validate partial snapshot, redacting any lines nested 2+ indent levels.
insta::with_settings!({filters => vec![(r"(?m)(^ .*$\r?\n)+", " [...]\n")]}, { insta::with_settings!({filters => vec![(r"(?m)(^ .*$\r?\n)+", " [...]\n")]}, {
assert_snapshot!(stdout, @r#" assert_snapshot!(output, @r#"
{ {
"$schema": "http://json-schema.org/draft-04/schema", "$schema": "http://json-schema.org/draft-04/schema",
"$comment": "`taplo` and the corresponding VS Code plugins only support draft-04 verstion of JSON Schema, see <https://taplo.tamasfe.dev/configuration/developing-schemas.html>. draft-07 is mostly compatible with it, newer versions may not be.", "$comment": "`taplo` and the corresponding VS Code plugins only support draft-04 verstion of JSON Schema, see <https://taplo.tamasfe.dev/configuration/developing-schemas.html>. draft-07 is mostly compatible with it, newer versions may not be.",

View File

@ -266,7 +266,7 @@ fn test_materialize_and_snapshot_different_conflict_markers() {
.unwrap(); .unwrap();
// Git-style markers should be parsed, then rendered with new config // Git-style markers should be parsed, then rendered with new config
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]), @r"
diff --git a/file b/file diff --git a/file b/file
--- a/file --- a/file
+++ b/file +++ b/file
@ -424,8 +424,8 @@ fn test_conflict_marker_length_stored_in_working_copy() {
.unwrap(); .unwrap();
// The file should still be conflicted, and the new content should be saved // The file should still be conflicted, and the new content should be saved
let stdout = test_env.jj_cmd_success(&repo_path, &["st"]); let output = test_env.run_jj_in(&repo_path, ["st"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
M file M file
Working copy : mzvwutvl 3a981880 (conflict) (no description set) Working copy : mzvwutvl 3a981880 (conflict) (no description set)
@ -435,7 +435,7 @@ fn test_conflict_marker_length_stored_in_working_copy() {
file 2-sided conflict file 2-sided conflict
[EOF] [EOF]
"); ");
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]), @r" insta::assert_snapshot!(test_env.run_jj_in(&repo_path, ["diff", "--git"]), @r"
diff --git a/file b/file diff --git a/file b/file
--- a/file --- a/file
+++ b/file +++ b/file
@ -479,8 +479,8 @@ fn test_conflict_marker_length_stored_in_working_copy() {
) )
.unwrap(); .unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["st"]); let output = test_env.run_jj_in(&repo_path, ["st"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
Working copy changes: Working copy changes:
M file M file
Working copy : mzvwutvl 1aefd866 (no description set) Working copy : mzvwutvl 1aefd866 (no description set)

View File

@ -30,8 +30,8 @@ fn test_workspaces_add_second_workspace() {
std::fs::write(main_path.join("file"), "contents").unwrap(); std::fs::write(main_path.join("file"), "contents").unwrap();
test_env.jj_cmd_ok(&main_path, &["commit", "-m", "initial"]); test_env.jj_cmd_ok(&main_path, &["commit", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz 8183d0fc (empty) (no description set) default: rlvkpnrz 8183d0fc (empty) (no description set)
[EOF] [EOF]
"); ");
@ -69,8 +69,8 @@ fn test_workspaces_add_second_workspace() {
"); ");
// Both workspaces show up when we list them // Both workspaces show up when we list them
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz 8183d0fc (empty) (no description set) default: rlvkpnrz 8183d0fc (empty) (no description set)
second: rzvqmyuk 5ed2222c (empty) (no description set) second: rzvqmyuk 5ed2222c (empty) (no description set)
[EOF] [EOF]
@ -91,15 +91,15 @@ fn test_workspaces_sparse_patterns() {
test_env.jj_cmd_ok(&ws1_path, &["sparse", "set", "--clear", "--add=foo"]); test_env.jj_cmd_ok(&ws1_path, &["sparse", "set", "--clear", "--add=foo"]);
test_env.jj_cmd_ok(&ws1_path, &["workspace", "add", "../ws2"]); test_env.jj_cmd_ok(&ws1_path, &["workspace", "add", "../ws2"]);
let stdout = test_env.jj_cmd_success(&ws2_path, &["sparse", "list"]); let output = test_env.run_jj_in(&ws2_path, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
foo foo
[EOF] [EOF]
"); ");
test_env.jj_cmd_ok(&ws2_path, &["sparse", "set", "--add=bar"]); test_env.jj_cmd_ok(&ws2_path, &["sparse", "set", "--add=bar"]);
test_env.jj_cmd_ok(&ws2_path, &["workspace", "add", "../ws3"]); test_env.jj_cmd_ok(&ws2_path, &["workspace", "add", "../ws3"]);
let stdout = test_env.jj_cmd_success(&ws3_path, &["sparse", "list"]); let output = test_env.run_jj_in(&ws3_path, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
bar bar
foo foo
[EOF] [EOF]
@ -109,8 +109,8 @@ fn test_workspaces_sparse_patterns() {
&ws3_path, &ws3_path,
&["workspace", "add", "--sparse-patterns=copy", "../ws4"], &["workspace", "add", "--sparse-patterns=copy", "../ws4"],
); );
let stdout = test_env.jj_cmd_success(&ws4_path, &["sparse", "list"]); let output = test_env.run_jj_in(&ws4_path, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
bar bar
foo foo
[EOF] [EOF]
@ -119,8 +119,8 @@ fn test_workspaces_sparse_patterns() {
&ws3_path, &ws3_path,
&["workspace", "add", "--sparse-patterns=full", "../ws5"], &["workspace", "add", "--sparse-patterns=full", "../ws5"],
); );
let stdout = test_env.jj_cmd_success(&ws5_path, &["sparse", "list"]); let output = test_env.run_jj_in(&ws5_path, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
. .
[EOF] [EOF]
"); ");
@ -128,8 +128,8 @@ fn test_workspaces_sparse_patterns() {
&ws3_path, &ws3_path,
&["workspace", "add", "--sparse-patterns=empty", "../ws6"], &["workspace", "add", "--sparse-patterns=empty", "../ws6"],
); );
let stdout = test_env.jj_cmd_success(&ws6_path, &["sparse", "list"]); let output = test_env.run_jj_in(&ws6_path, ["sparse", "list"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
} }
/// Test adding a second workspace while the current workspace is editing a /// Test adding a second workspace while the current workspace is editing a
@ -144,8 +144,8 @@ fn test_workspaces_add_second_workspace_on_merge() {
test_env.jj_cmd_ok(&main_path, &["new", "@-", "-m=right"]); test_env.jj_cmd_ok(&main_path, &["new", "@-", "-m=right"]);
test_env.jj_cmd_ok(&main_path, &["new", "all:@-+", "-m=merge"]); test_env.jj_cmd_ok(&main_path, &["new", "all:@-+", "-m=merge"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: zsuskuln 35e47bff (empty) merge default: zsuskuln 35e47bff (empty) merge
[EOF] [EOF]
"); ");
@ -245,8 +245,8 @@ fn test_workspaces_add_at_operation() {
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&secondary_path, &["op", "log", "-Tdescription"]); let output = test_env.run_jj_in(&secondary_path, ["op", "log", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ snapshot working copy @ snapshot working copy
reconcile divergent operations reconcile divergent operations
@ -277,8 +277,8 @@ fn test_workspaces_add_workspace_at_revision() {
std::fs::write(main_path.join("file-2"), "contents").unwrap(); std::fs::write(main_path.join("file-2"), "contents").unwrap();
test_env.jj_cmd_ok(&main_path, &["commit", "-m", "second"]); test_env.jj_cmd_ok(&main_path, &["commit", "-m", "second"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: kkmpptxz dadeedb4 (empty) (no description set) default: kkmpptxz dadeedb4 (empty) (no description set)
[EOF] [EOF]
"); ");
@ -406,8 +406,8 @@ fn test_workspaces_add_workspace_from_subdir() {
std::fs::write(subdir_path.join("file"), "contents").unwrap(); std::fs::write(subdir_path.join("file"), "contents").unwrap();
test_env.jj_cmd_ok(&main_path, &["commit", "-m", "initial"]); test_env.jj_cmd_ok(&main_path, &["commit", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz e1038e77 (empty) (no description set) default: rlvkpnrz e1038e77 (empty) (no description set)
[EOF] [EOF]
"); ");
@ -425,8 +425,8 @@ fn test_workspaces_add_workspace_from_subdir() {
"#); "#);
// Both workspaces show up when we list them // Both workspaces show up when we list them
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "list"]); let output = test_env.run_jj_in(&secondary_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz e1038e77 (empty) (no description set) default: rlvkpnrz e1038e77 (empty) (no description set)
secondary: rzvqmyuk 7ad84461 (empty) (no description set) secondary: rzvqmyuk 7ad84461 (empty) (no description set)
[EOF] [EOF]
@ -455,8 +455,8 @@ fn test_workspaces_add_workspace_in_current_workspace() {
"#); "#);
// Workspace created despite warning // Workspace created despite warning
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz 46d9ba8b (no description set) default: rlvkpnrz 46d9ba8b (no description set)
secondary: pmmvwywv 0a77a39d (empty) (no description set) secondary: pmmvwywv 0a77a39d (empty) (no description set)
[EOF] [EOF]
@ -474,8 +474,8 @@ fn test_workspaces_add_workspace_in_current_workspace() {
"#); "#);
// Both workspaces created // Both workspaces created
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz 477c647f (no description set) default: rlvkpnrz 477c647f (no description set)
secondary: pmmvwywv 0a77a39d (empty) (no description set) secondary: pmmvwywv 0a77a39d (empty) (no description set)
third: zxsnswpr 64746d4b (empty) (no description set) third: zxsnswpr 64746d4b (empty) (no description set)
@ -484,8 +484,8 @@ fn test_workspaces_add_workspace_in_current_workspace() {
// Can see files from the other workspaces in main workspace, since they are // Can see files from the other workspaces in main workspace, since they are
// child directories and will therefore be snapshotted // child directories and will therefore be snapshotted
let stdout = test_env.jj_cmd_success(&main_path, &["file", "list"]); let output = test_env.run_jj_in(&main_path, ["file", "list"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r" insta::assert_snapshot!(output.normalize_backslash(), @r"
file file
secondary/file secondary/file
third/file third/file
@ -782,9 +782,9 @@ fn test_workspaces_current_op_discarded_by_other(automatic: bool) {
// changes the target tree in the secondary workspace. // changes the target tree in the secondary workspace.
test_env.jj_cmd_ok(&main_path, &["abandon", "@-"]); test_env.jj_cmd_ok(&main_path, &["abandon", "@-"]);
let stdout = test_env.jj_cmd_success( let output = test_env.run_jj_in(
&main_path, &main_path,
&[ [
"operation", "operation",
"log", "log",
"--template", "--template",
@ -792,7 +792,7 @@ fn test_workspaces_current_op_discarded_by_other(automatic: bool) {
], ],
); );
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 757bc1140b abandon commit 20dd439c4bd12c6ad56c187ac490bd0141804618f638dc5c4dc92ff9aecba20f152b23160db9dcf61beb31a5cb14091d9def5a36d11c9599cc4d2e5689236af1 @ 757bc1140b abandon commit 20dd439c4bd12c6ad56c187ac490bd0141804618f638dc5c4dc92ff9aecba20f152b23160db9dcf61beb31a5cb14091d9def5a36d11c9599cc4d2e5689236af1
8d4abed655 create initial working-copy commit in workspace secondary 8d4abed655 create initial working-copy commit in workspace secondary
3de27432e5 add workspace 'secondary' 3de27432e5 add workspace 'secondary'
@ -873,9 +873,9 @@ fn test_workspaces_current_op_discarded_by_other(automatic: bool) {
} }
// The sparse patterns should remain // The sparse patterns should remain
let stdout = test_env.jj_cmd_success(&secondary_path, &["sparse", "list"]); let output = test_env.run_jj_in(&secondary_path, ["sparse", "list"]);
insta::allow_duplicates! { insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
added added
deleted deleted
modified modified
@ -945,8 +945,8 @@ fn test_workspaces_update_stale_noop() {
[exit status: 1] [exit status: 1]
"); ");
let stdout = test_env.jj_cmd_success(&main_path, &["op", "log", "-Tdescription"]); let output = test_env.run_jj_in(&main_path, ["op", "log", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ add workspace 'default' @ add workspace 'default'
[EOF] [EOF]
@ -1006,8 +1006,8 @@ fn test_workspaces_forget() {
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
// When listing workspaces, only the secondary workspace shows up // When listing workspaces, only the secondary workspace shows up
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
secondary: pmmvwywv 18463f43 (empty) (no description set) secondary: pmmvwywv 18463f43 (empty) (no description set)
[EOF] [EOF]
"); ");
@ -1058,8 +1058,8 @@ fn test_workspaces_forget() {
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(stderr, @"");
// No workspaces left // No workspaces left
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
} }
#[test] #[test]
@ -1075,8 +1075,8 @@ fn test_workspaces_forget_multi_transaction() {
test_env.jj_cmd_ok(&main_path, &["workspace", "add", "../third"]); test_env.jj_cmd_ok(&main_path, &["workspace", "add", "../third"]);
// there should be three workspaces // there should be three workspaces
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz 909d51b1 (empty) (no description set) default: rlvkpnrz 909d51b1 (empty) (no description set)
second: pmmvwywv 18463f43 (empty) (no description set) second: pmmvwywv 18463f43 (empty) (no description set)
third: rzvqmyuk cc383fa2 (empty) (no description set) third: rzvqmyuk cc383fa2 (empty) (no description set)
@ -1085,15 +1085,15 @@ fn test_workspaces_forget_multi_transaction() {
// delete two at once, in a single tx // delete two at once, in a single tx
test_env.jj_cmd_ok(&main_path, &["workspace", "forget", "second", "third"]); test_env.jj_cmd_ok(&main_path, &["workspace", "forget", "second", "third"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz 909d51b1 (empty) (no description set) default: rlvkpnrz 909d51b1 (empty) (no description set)
[EOF] [EOF]
"); ");
// the op log should have multiple workspaces forgotten in a single tx // the op log should have multiple workspaces forgotten in a single tx
let stdout = test_env.jj_cmd_success(&main_path, &["op", "log", "--limit", "1"]); let output = test_env.run_jj_in(&main_path, ["op", "log", "--limit", "1"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ 60b2b5a71a84 test-username@host.example.com 2001-02-03 04:05:12.000 +07:00 - 2001-02-03 04:05:12.000 +07:00 @ 60b2b5a71a84 test-username@host.example.com 2001-02-03 04:05:12.000 +07:00 - 2001-02-03 04:05:12.000 +07:00
forget workspaces second, third forget workspaces second, third
args: jj workspace forget second third args: jj workspace forget second third
@ -1104,8 +1104,8 @@ fn test_workspaces_forget_multi_transaction() {
test_env.jj_cmd_ok(&main_path, &["op", "undo"]); test_env.jj_cmd_ok(&main_path, &["op", "undo"]);
// finally, there should be three workspaces at the end // finally, there should be three workspaces at the end
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: rlvkpnrz 909d51b1 (empty) (no description set) default: rlvkpnrz 909d51b1 (empty) (no description set)
second: pmmvwywv 18463f43 (empty) (no description set) second: pmmvwywv 18463f43 (empty) (no description set)
third: rzvqmyuk cc383fa2 (empty) (no description set) third: rzvqmyuk cc383fa2 (empty) (no description set)
@ -1130,8 +1130,8 @@ fn test_workspaces_forget_abandon_commits() {
test_env.jj_cmd_ok(&fourth_path, &["edit", "second@"]); test_env.jj_cmd_ok(&fourth_path, &["edit", "second@"]);
// there should be four workspaces, three of which are at the same empty commit // there should be four workspaces, three of which are at the same empty commit
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: qpvuntsm 4e8f9d2b (no description set) default: qpvuntsm 4e8f9d2b (no description set)
fourth: uuqppmxq 57d63245 (empty) (no description set) fourth: uuqppmxq 57d63245 (empty) (no description set)
second: uuqppmxq 57d63245 (empty) (no description set) second: uuqppmxq 57d63245 (empty) (no description set)
@ -1199,15 +1199,15 @@ fn test_list_workspaces_template() {
); );
// "current_working_copy" should point to the workspace we operate on // "current_working_copy" should point to the workspace we operate on
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: 8183d0fcaa4c (current) default: 8183d0fcaa4c (current)
second: 0a77a39d7d6f second: 0a77a39d7d6f
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "list"]); let output = test_env.run_jj_in(&secondary_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: 8183d0fcaa4c default: 8183d0fcaa4c
second: 0a77a39d7d6f (current) second: 0a77a39d7d6f (current)
[EOF] [EOF]
@ -1222,15 +1222,15 @@ fn test_workspaces_root() {
let main_path = test_env.env_root().join("main"); let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary"); let secondary_path = test_env.env_root().join("secondary");
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "root"]); let output = test_env.run_jj_in(&main_path, ["workspace", "root"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
$TEST_ENV/main $TEST_ENV/main
[EOF] [EOF]
"); ");
let main_subdir_path = main_path.join("subdir"); let main_subdir_path = main_path.join("subdir");
std::fs::create_dir(&main_subdir_path).unwrap(); std::fs::create_dir(&main_subdir_path).unwrap();
let stdout = test_env.jj_cmd_success(&main_subdir_path, &["workspace", "root"]); let output = test_env.run_jj_in(&main_subdir_path, ["workspace", "root"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
$TEST_ENV/main $TEST_ENV/main
[EOF] [EOF]
"); ");
@ -1239,15 +1239,15 @@ fn test_workspaces_root() {
&main_path, &main_path,
&["workspace", "add", "--name", "secondary", "../secondary"], &["workspace", "add", "--name", "secondary", "../secondary"],
); );
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "root"]); let output = test_env.run_jj_in(&secondary_path, ["workspace", "root"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
$TEST_ENV/secondary $TEST_ENV/secondary
[EOF] [EOF]
"); ");
let secondary_subdir_path = secondary_path.join("subdir"); let secondary_subdir_path = secondary_path.join("subdir");
std::fs::create_dir(&secondary_subdir_path).unwrap(); std::fs::create_dir(&secondary_subdir_path).unwrap();
let stdout = test_env.jj_cmd_success(&secondary_subdir_path, &["workspace", "root"]); let output = test_env.run_jj_in(&secondary_subdir_path, ["workspace", "root"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
$TEST_ENV/secondary $TEST_ENV/secondary
[EOF] [EOF]
"); ");
@ -1261,8 +1261,8 @@ fn test_debug_snapshot() {
std::fs::write(repo_path.join("file"), "contents").unwrap(); std::fs::write(repo_path.join("file"), "contents").unwrap();
test_env.jj_cmd_ok(&repo_path, &["debug", "snapshot"]); test_env.jj_cmd_ok(&repo_path, &["debug", "snapshot"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ c55ebc67e3db test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 @ c55ebc67e3db test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
snapshot working copy snapshot working copy
args: jj debug snapshot args: jj debug snapshot
@ -1272,8 +1272,8 @@ fn test_debug_snapshot() {
[EOF] [EOF]
"); ");
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
@ c9a40b951848 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00 @ c9a40b951848 test-username@host.example.com 2001-02-03 04:05:10.000 +07:00 - 2001-02-03 04:05:10.000 +07:00
describe commit 4e8f9d2be039994f589b4e57ac5e9488703e604d describe commit 4e8f9d2be039994f589b4e57ac5e9488703e604d
args: jj describe -m initial args: jj describe -m initial
@ -1351,18 +1351,18 @@ fn test_workspaces_rename_workspace() {
let secondary_path = test_env.env_root().join("secondary"); let secondary_path = test_env.env_root().join("secondary");
// Both workspaces show up when we list them // Both workspaces show up when we list them
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: qpvuntsm 230dd059 (empty) (no description set) default: qpvuntsm 230dd059 (empty) (no description set)
second: uuqppmxq 57d63245 (empty) (no description set) second: uuqppmxq 57d63245 (empty) (no description set)
[EOF] [EOF]
"); ");
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "rename", "third"]); let output = test_env.run_jj_in(&secondary_path, ["workspace", "rename", "third"]);
insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(output, @"");
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]); let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(stdout, @r" insta::assert_snapshot!(output, @r"
default: qpvuntsm 230dd059 (empty) (no description set) default: qpvuntsm 230dd059 (empty) (no description set)
third: uuqppmxq 57d63245 (empty) (no description set) third: uuqppmxq 57d63245 (empty) (no description set)
[EOF] [EOF]