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", &[]);
// Test the setup
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
a
[EOF]
@ -438,8 +438,8 @@ fn test_abandon_restore_descendants() {
Parent commit : qpvuntsm 485d52a9 (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file b/file
index 257cc5642c..76018072e0 100644
--- a/file

View File

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

View File

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

View File

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

View File

@ -1683,9 +1683,9 @@ fn test_bookmark_list_filtered() {
let template = r#"separate(" ", commit_id.short(), bookmarks, if(hidden, "(hidden)"))"#;
insta::assert_snapshot!(
test_env.jj_cmd_success(
test_env.run_jj_in(
&local_path,
&["log", "-r::(bookmarks() | remote_bookmarks())", "-T", template],
["log", "-r::(bookmarks() | remote_bookmarks())", "-T", template],
),
@r"
@ c7b4c09cd77c local-keep
@ -2154,7 +2154,7 @@ fn test_bookmark_list_conflicted() {
+ kkmpptxz 06a973bc (empty) b
[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):
+ rlvkpnrz d8d5f980 (empty) a
+ 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() {
let (test_env, workspace_root) = set_up("main");
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd
(empty) description 1
~
@ -66,8 +66,8 @@ fn test_builtin_alias_trunk_matches_main() {
fn test_builtin_alias_trunk_matches_master() {
let (test_env, workspace_root) = set_up("master");
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 master d13ecdbd
(empty) description 1
~
@ -79,8 +79,8 @@ fn test_builtin_alias_trunk_matches_master() {
fn test_builtin_alias_trunk_matches_trunk() {
let (test_env, workspace_root) = set_up("trunk");
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 trunk d13ecdbd
(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, &["bookmark", "create", "-r@", "master"]);
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd
(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"))'"#,
);
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&workspace_root, ["log", "-r", "trunk()"]);
insta::assert_snapshot!(output, @r"
xtvrqkyv test.user@example.com 2001-02-03 08:05:08 override-trunk d13ecdbd
(empty) description 1
~

View File

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

View File

@ -30,8 +30,8 @@ fn test_log_parents() {
let template =
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]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(output, @r"
@ c067170d4ca1bc6162b64f7550617ec809647f84
P: 2 4db490c88528133d579540b6900b8098f0c17701 230dd059e1b059aefc0da06a2e5a7dbf22362f22
4db490c88528133d579540b6900b8098f0c17701
@ -46,8 +46,8 @@ fn test_log_parents() {
// List<Commit> can be filtered
let template =
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]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(output, @r"
@ P: 4db490c88528 230dd059e1b0
P: 230dd059e1b0
@ -58,11 +58,8 @@ fn test_log_parents() {
");
let template = r#"parents.map(|c| c.commit_id().shortest(4))"#;
let stdout = test_env.jj_cmd_success(
&repo_path,
&["log", "-T", template, "-r@", "--color=always"],
);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", template, "-r@", "--color=always"]);
insta::assert_snapshot!(output, @r"
@ 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, &["new", "-m", "second"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp()"]);
insta::assert_snapshot!(output, @r"
@ 2001-02-03 04:05:09.000 +07:00
2001-02-03 04:05:08.000 +07: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"]);
let repo_path = test_env.env_root().join("repo");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().utc()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp().utc()"]);
insta::assert_snapshot!(output, @r"
@ 2001-02-02 21:05:07.000 +00:00
1970-01-01 00:00:00.000 +00:00
[EOF]
@ -161,15 +158,15 @@ fn test_log_author_timestamp_local() {
let repo_path = test_env.env_root().join("repo");
test_env.add_env_var("TZ", "UTC-05:30");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().local()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp().local()"]);
insta::assert_snapshot!(output, @r"
@ 2001-02-03 08:05:07.000 +11:00
1970-01-01 11:00:00.000 +11:00
[EOF]
");
test_env.add_env_var("TZ", "UTC+10:00");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().local()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "author.timestamp().local()"]);
insta::assert_snapshot!(output, @r"
@ 2001-02-03 08:05:07.000 +11:00
1970-01-01 11:00:00.000 +11:00
[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("now"), "(before now)", "(after now)")
) ++ "\n""#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(output, @r"
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)
[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,
&[
[
"log",
"-T",
r#"coalesce(if(mine, "mine"), author.email(), email_placeholder)"#,
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ johndoe@example.com
mine
(no email set)
@ -260,8 +257,8 @@ fn test_log_default() {
test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@", "my-bookmark"]);
// Test default log output format
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log"]);
insta::assert_snapshot!(output, @r"
@ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e
(empty) description 1
qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7
@ -271,8 +268,8 @@ fn test_log_default() {
");
// Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--color=always"]);
insta::assert_snapshot!(output, @r"
@ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e
(empty) description 1
qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7
@ -282,8 +279,8 @@ fn test_log_default() {
");
// Color without graph
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always", "--no-graph"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--color=always", "--no-graph"]);
insta::assert_snapshot!(output, @r"
kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e
(empty) description 1
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");
test_env.jj_cmd_ok(&repo_path, &["workspace", "forget"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log"]);
insta::assert_snapshot!(output, @r"
zzzzzzzz root() 00000000
[EOF]
");
@ -522,9 +519,9 @@ fn test_log_evolog_divergence() {
std::fs::write(repo_path.join("file"), "foo\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 1"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
// 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
description 1
zzzzzzzz root() 00000000
@ -551,8 +548,8 @@ fn test_log_evolog_divergence() {
");
// Color
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--color=always"]);
insta::assert_snapshot!(output, @r"
@ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29
description 1
qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00
@ -562,8 +559,8 @@ fn test_log_evolog_divergence() {
");
// Evolog and hidden divergent
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog"]);
insta::assert_snapshot!(output, @r"
@ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29
description 1
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 485d52a9
@ -574,8 +571,8 @@ fn test_log_evolog_divergence() {
");
// Colored evolog
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--color=always"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog", "--color=always"]);
insta::assert_snapshot!(output, @r"
@ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29
description 1
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"]);
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"
@ a5b4d15489cc bookmark2* new-bookmark
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 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"
@ bookmark2, new-bookmark
origin/bookmark2, unchanged
@ -670,7 +667,7 @@ fn test_log_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"
@ L: bookmark2* new-bookmark R:
L: unchanged R: bookmark2@origin unchanged@origin
@ -692,9 +689,9 @@ fn test_log_bookmarks() {
++ "/-" ++ ref.tracking_behind_count().lower() ++ ")"),
))
"#;
let output = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&workspace_root,
&["log", "-r::remote_bookmarks()", "-T", template],
["log", "-r::remote_bookmarks()", "-T", template],
);
insta::assert_snapshot!(output, @r"
bookmark3@origin(+0/-1)
@ -717,16 +714,16 @@ fn test_log_git_head() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m=initial"]);
std::fs::write(repo_path.join("file"), "foo\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "git_head"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "git_head"]);
insta::assert_snapshot!(output, @r"
@ false
true
false
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--color=always"]);
insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 50aaf475
initial
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", "second"]);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"-T",
r#"commit_id ++ ": " ++ commit_id.normal_hex()"#,
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ 6572f22267c6f0f2bf7b8a37969ee5a7d54b8aae: 6572f22267c6f0f2bf7b8a37969ee5a7d54b8aae
222fa9f0b41347630a1371203b8aad3897d34e5f: 222fa9f0b41347630a1371203b8aad3897d34e5f
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", "second"]);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"-T",
r#"change_id ++ ": " ++ change_id.normal_hex()"#,
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ kkmpptxzrspxrzommnulwmwkkqwworpl: ffdaa62087a280bddc5e3d3ff933b8ae
rlvkpnrzqnoowoytxnquwvuryrwnrmlp: 8e4fac809cbb3b162c953458183c8dea
qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu: 9a45c67d3e96a7e5007c110ede34dec5
@ -798,15 +795,15 @@ fn test_log_customize_short_id() {
// Customize both the commit and the change 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,
&[
[
"log",
"--config",
&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
(empty) first
Z_zzzz root() 0_0000
@ -814,14 +811,14 @@ fn test_log_customize_short_id() {
");
// Customize only the change id
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"--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
(empty) first
ZZZZZZZZ root() 00000000
@ -849,8 +846,8 @@ fn test_log_immutable() {
"#;
test_env.add_config("revset-aliases.'immutable_heads()' = 'main'");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r::", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r::", "-T", template]);
insta::assert_snapshot!(output, @r"
@ D
C
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,
&[
[
"log",
"-r::",
"-T",
&template_for_revset(r#"description(A)::"#),
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ D
C [contained_in]
B main [contained_in]
@ -939,16 +936,16 @@ fn test_log_contained_in() {
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"-r::",
"-T",
&template_for_revset(r#"visible_heads()"#),
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ D [contained_in]
C [contained_in]
B main
@ -1075,8 +1072,8 @@ fn test_short_prefix_in_transaction() {
");
// Should match log's short prefixes
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph"]);
insta::assert_snapshot!(output, @r"
km[kuslswpqwq] 7[4ac55dd119b] test
y[qosqzytrlsw] 5[8731db5875e] commit4
r[oyxmykxtrkr] 9[95cc897bca7] commit3
@ -1090,8 +1087,8 @@ fn test_short_prefix_in_transaction() {
test_env.add_config(r#"revsets.short-prefixes = """#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph"]);
insta::assert_snapshot!(output, @r"
kmk[uslswpqwq] 74ac[55dd119b] test
yq[osqzytrlsw] 587[31db5875e] commit4
ro[yxmykxtrkr] 99[5cc897bca7] commit3
@ -1136,11 +1133,11 @@ fn test_log_diff_predefined_formats() {
"#;
// color, without paths
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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 ===
Modified regular file file1:
 1  1: a
@ -1183,11 +1180,11 @@ fn test_log_diff_predefined_formats() {
");
// color labels
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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 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>>
@ -1230,11 +1227,11 @@ fn test_log_diff_predefined_formats() {
");
// cwd != workspace root
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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 ===
Modified regular file repo/file1:
1 1: a
@ -1286,9 +1283,9 @@ fn test_log_diff_predefined_formats() {
"},
)
.unwrap();
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"--config-file=../config-good.toml",
"--no-graph",
@ -1297,7 +1294,7 @@ fn test_log_diff_predefined_formats() {
template,
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
=== color_words ===
Modified regular file file1:
...
@ -1372,8 +1369,8 @@ fn test_log_diff_predefined_formats() {
// color_words() with parameters
let template = "self.diff('file1').color_words(0)";
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-T", template]);
insta::assert_snapshot!(output, @r"
Modified regular file file1:
...
3: c
@ -1382,8 +1379,8 @@ fn test_log_diff_predefined_formats() {
// git() with parameters
let template = "self.diff('file1').git(1)";
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-T", template]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
index 422c2b7ab3..de980441c3 100644
--- a/file1
@ -1410,8 +1407,8 @@ fn test_log_diff_predefined_formats() {
) ++ "\n",
)
"#};
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(output, @r"
=== fbad2dd53d06 ===
file1 [modified] source=file1 [file] target=file1 [file]
file2 [modified] source=file2 [file] target=file2 [file]
@ -1437,8 +1434,8 @@ fn test_log_diff_predefined_formats() {
) ++ "\n",
)
"#};
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-T", template]);
insta::assert_snapshot!(output, @r"
=== fbad2dd53d06 ===
* total_added=3 total_removed=1
=== 3c9b3178609b ===
@ -1480,8 +1477,8 @@ fn test_file_list_entries() {
"executable=" ++ executable,
) ++ "\n"
"#};
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "list", "-T", template]);
insta::assert_snapshot!(output, @r"
conflict-exec-file [conflict] conflict=true executable=true
conflict-file [conflict] conflict=true 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();
let template = r#"separate(" ", path, "[" ++ file_type ++ "]") ++ "\n""#;
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "list", "-T", template]);
insta::assert_snapshot!(output, @r"
symlink [symlink]
[EOF]
");
@ -1525,16 +1522,16 @@ fn test_repo_path() {
"parent^2=" ++ if(path.parent().parent(), path.parent().parent(), "<none>"),
) ++ "\n"
"#};
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list", "-T", template]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["file", "list", "-T", template]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
dir/file display=dir/file parent=dir parent^2=
file display=file parent= parent^2=<none>
[EOF]
");
let template = r#"separate(" ", path, "display=" ++ path.display()) ++ "\n""#;
let stdout = test_env.jj_cmd_success(&repo_path.join("dir"), &["file", "list", "-T", template]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path.join("dir"), ["file", "list", "-T", template]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
dir/file display=file
file display=../file
[EOF]
@ -1560,15 +1557,15 @@ fn test_signature_templates() {
) ++ " signature""#;
// show that signatures can render
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(output, @r"
@ good test-display signature
no signature
no signature
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-T", template]);
insta::assert_snapshot!(stdout, @"good test-display signature[EOF]");
let output = test_env.run_jj_in(&repo_path, ["show", "-T", template]);
insta::assert_snapshot!(output, @"good test-display signature[EOF]");
// builtin templates
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");
let test_env = test_env;
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "rename", ""]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "rename", ""]);
insta::assert_snapshot!(output, @r"
aaa-local x
aaa-tracked x
bbb-local x
@ -94,74 +94,74 @@ fn test_bookmark_names() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "rename", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "rename", "a"]);
insta::assert_snapshot!(output, @r"
aaa-local x
aaa-tracked x
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "delete", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "delete", "a"]);
insta::assert_snapshot!(output, @r"
aaa-local x
aaa-tracked x
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "forget", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "forget", "a"]);
insta::assert_snapshot!(output, @r"
aaa-local x
aaa-tracked x
aaa-untracked
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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-tracked x
aaa-untracked
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "move", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "move", "a"]);
insta::assert_snapshot!(output, @r"
aaa-local x
aaa-tracked x
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "set", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "set", "a"]);
insta::assert_snapshot!(output, @r"
aaa-local x
aaa-tracked x
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "track", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "track", "a"]);
insta::assert_snapshot!(output, @r"
aaa-untracked@origin x
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "bookmark", "untrack", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "bookmark", "untrack", "a"]);
insta::assert_snapshot!(output, @r"
aaa-tracked@origin x
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "git", "push", "-b", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "git", "push", "-b", "a"]);
insta::assert_snapshot!(output, @r"
aaa-local x
aaa-tracked x
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "git", "fetch", "-b", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "git", "fetch", "-b", "a"]);
insta::assert_snapshot!(output, @r"
aaa-local x
aaa-tracked x
aaa-untracked
@ -181,9 +181,9 @@ fn test_global_arg_repository_is_respected() {
test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env;
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
test_env.env_root(),
&[
[
"--",
"jj",
"--repository",
@ -193,7 +193,7 @@ fn test_global_arg_repository_is_respected() {
"a",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
aaa (no description set)
[EOF]
");
@ -219,14 +219,14 @@ fn test_aliases_are_resolved() {
test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env;
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "b", "rename", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "b", "rename", "a"]);
insta::assert_snapshot!(output, @r"
aaa (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "b2", "rename", "a"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "b2", "rename", "a"]);
insta::assert_snapshot!(output, @r"
aaa (no description set)
[EOF]
");
@ -297,56 +297,56 @@ fn test_remote_names() {
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(),
&["--", "jj", "git", "remote", "remove", "o"],
["--", "jj", "git", "remote", "remove", "o"],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
origin
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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
[EOF]
");
@ -376,16 +376,16 @@ fn test_aliases_are_completed() {
test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env;
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "user-al"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "user-al"]);
insta::assert_snapshot!(output, @r"
user-alias
[EOF]
");
// make sure --repository flag is respected
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
test_env.env_root(),
&[
[
"--",
"jj",
"--repository",
@ -393,22 +393,22 @@ fn test_aliases_are_completed() {
"repo-al",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
repo-alias
[EOF]
");
// cannot load aliases from --config flag
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
test_env.env_root(),
&[
[
"--",
"jj",
"--config=aliases.cli-alias=['bookmark']",
"cli-al",
],
);
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(output, @"");
}
#[test]
@ -466,8 +466,8 @@ fn test_revisions() {
// completion function should be sufficient.
// complete all revisions
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "diff", "--from", ""]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "diff", "--from", ""]);
insta::assert_snapshot!(output, @r"
immutable_bookmark immutable
mutable_bookmark mutable
k working_copy
@ -482,8 +482,8 @@ fn test_revisions() {
");
// complete only mutable revisions
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "squash", "--into", ""]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "squash", "--into", ""]);
insta::assert_snapshot!(output, @r"
mutable_bookmark mutable
k working_copy
y mutable
@ -495,8 +495,8 @@ fn test_revisions() {
// complete args of the default command
test_env.add_config("ui.default-command = 'log'");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "-r", ""]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "-r", ""]);
insta::assert_snapshot!(output, @r"
immutable_bookmark immutable
mutable_bookmark mutable
k working_copy
@ -544,58 +544,58 @@ fn test_operations() {
.unwrap();
insta::assert_snapshot!(add_workspace_id, @"eac759b9ab75");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "show", "5"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "show", "5"]);
insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
518b588abbc6 (2001-02-03 08:05:09) describe commit 19611c995a342c01f525583e5fcafdd211f6d009
[EOF]
");
// make sure global --at-op flag is respected
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "--at-op", "5b"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "--at-op", "5b"]);
insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "abandon", "5b"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "abandon", "5b"]);
insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "diff", "--op", "5b"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "diff", "--op", "5b"]);
insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "diff", "--from", "5b"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "diff", "--from", "5b"]);
insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "diff", "--to", "5b"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "diff", "--to", "5b"]);
insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "restore", "5b"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "restore", "5b"]);
insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "op", "undo", "5b"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "op", "undo", "5b"]);
insta::assert_snapshot!(output, @r"
5bbb4ca536a8 (2001-02-03 08:05:12) describe commit 968261075dddabf4b0e333c1cc9a49ce26a3f710
[EOF]
");
@ -620,8 +620,8 @@ fn test_workspaces() {
test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env;
let stdout = test_env.jj_cmd_success(&main_path, &["--", "jj", "workspace", "forget", "def"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["--", "jj", "workspace", "forget", "def"]);
insta::assert_snapshot!(output, @r"
def-second (no description set)
default initial
[EOF]
@ -634,15 +634,15 @@ fn test_config() {
test_env.add_env_var("COMPLETE", "fish");
let dir = test_env.env_root();
let stdout = test_env.jj_cmd_success(dir, &["--", "jj", "config", "get", "c"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(dir, ["--", "jj", "config", "get", "c"]);
insta::assert_snapshot!(output, @r"
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.
[EOF]
");
let stdout = test_env.jj_cmd_success(dir, &["--", "jj", "config", "list", "c"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(dir, ["--", "jj", "config", "list", "c"]);
insta::assert_snapshot!(output, @r"
colors Mapping from jj formatter labels to colors
core
core.fsmonitor Whether to use an external filesystem monitor, useful for large repos
@ -651,35 +651,35 @@ fn test_config() {
[EOF]
");
let stdout = test_env.jj_cmd_success(dir, &["--", "jj", "log", "--config", "c"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(dir, ["--", "jj", "log", "--config", "c"]);
insta::assert_snapshot!(output, @r"
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.
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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=snapshot
ui.conflict-marker-style=git
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
dir,
&[
[
"--",
"jj",
"log",
@ -687,7 +687,7 @@ fn test_config() {
"git.abandon-unreachable-commits=",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
git.abandon-unreachable-commits=false
git.abandon-unreachable-commits=true
[EOF]
@ -700,8 +700,8 @@ fn test_template_alias() {
test_env.add_env_var("COMPLETE", "fish");
let dir = test_env.env_root();
let stdout = test_env.jj_cmd_success(dir, &["--", "jj", "log", "-T", ""]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(dir, ["--", "jj", "log", "-T", ""]);
insta::assert_snapshot!(output, @r"
builtin_log_comfortable
builtin_log_compact
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"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "--summary"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
@ wqnwkozp test.user@example.com 2001-02-03 08:05:20 working_copy 45c3a621
working_copy
A f_added_2
@ -884,8 +884,8 @@ fn test_files() {
test_env.add_env_var("COMPLETE", "fish");
let test_env = test_env;
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "file", "show", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "file", "show", "f_"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added
f_added_2
f_dir/
@ -896,9 +896,8 @@ fn test_files() {
[EOF]
");
let stdout =
test_env.jj_cmd_success(&repo_path, &["--", "jj", "file", "annotate", "-r@-", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "file", "annotate", "-r@-", "f_"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added
f_dir/
f_modified
@ -907,8 +906,8 @@ fn test_files() {
f_unchanged
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "diff", "-r", "@-", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "diff", "-r", "@-", "f_"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added Added
f_deleted Deleted
f_dir/
@ -917,9 +916,9 @@ fn test_files() {
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"--",
"jj",
"diff",
@ -928,18 +927,18 @@ fn test_files() {
&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_2 Added
f_dir/dir_file_3 Added
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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_dir/
f_modified Added
@ -950,9 +949,9 @@ fn test_files() {
");
// 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,
&[
[
"--",
"jj",
"interdiff",
@ -961,7 +960,7 @@ fn test_files() {
"f_",
],
);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
insta::assert_snapshot!(output.normalize_backslash(), @r"
f_interdiff_only_from Added
f_interdiff_same Added
f_interdiff_only_to Added
@ -970,8 +969,8 @@ fn test_files() {
");
// squash has a different behavior with --from and --to flags
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "squash", "-f=first", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "squash", "-f=first", "f_"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
f_deleted Added
f_modified Added
f_not_yet_renamed Added
@ -979,16 +978,15 @@ fn test_files() {
[EOF]
");
let stdout =
test_env.jj_cmd_success(&repo_path, &["--", "jj", "resolve", "-r=conflicted", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "resolve", "-r=conflicted", "f_"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
f_dir/
f_modified
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--", "jj", "log", "f_"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["--", "jj", "log", "f_"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added
f_added_2
f_dir/
@ -998,9 +996,9 @@ fn test_files() {
f_unchanged
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"--",
"jj",
"log",
@ -1010,7 +1008,7 @@ fn test_files() {
"f_",
],
);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
insta::assert_snapshot!(output.normalize_backslash(), @r"
f_added_2
f_deleted
f_dir/
@ -1021,6 +1019,6 @@ fn test_files() {
");
let outside_repo = test_env.env_root();
let stdout = test_env.jj_cmd_success(outside_repo, &["--", "jj", "log", "f_"]);
insta::assert_snapshot!(stdout, @r"");
let output = test_env.run_jj_in(outside_repo, ["--", "jj", "log", "f_"]);
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
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--at-op=d74dff64472e"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--at-op=d74dff64472e"]);
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
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
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();
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
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
describe commit 4e8f9d2be039994f589b4e57ac5e9488703e604d
args: jj describe -m initial
@ -89,7 +89,7 @@ fn test_concurrent_operations_auto_rebase() {
000000000000 root()
[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(
@ -145,8 +145,8 @@ fn test_concurrent_operations_wc_modified() {
Concurrent modification detected, resolving automatically.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file b/file
index 12f00e90b6..2e0996000b 100644
--- a/file
@ -158,8 +158,8 @@ fn test_concurrent_operations_wc_modified() {
");
// The working copy should be committed after merging the operations
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "-Tdescription"]);
insta::assert_snapshot!(output, @r"
@ snapshot working copy
reconcile divergent operations
@ -193,8 +193,8 @@ fn test_concurrent_snapshot_wc_reloadable() {
test_env.jj_cmd_ok(&repo_path, &["commit", "-m", "new child1"]);
let template = r#"id ++ "\n" ++ description ++ "\n" ++ tags"#;
let op_log_stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-T", template]);
insta::assert_snapshot!(op_log_stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "-T", template]);
insta::assert_snapshot!(output, @r"
@ ec6bf266624bbaed55833a34ae62fa95c0e9efa651b94eb28846972da645845052dcdc8580332a5628849f23f48b9e99fc728dc3fb13106df8d0666d746f8b85
commit 554d22b2c43c1c47e279430197363e8daabe2fd6
args: jj commit -m 'new child1'
@ -213,7 +213,7 @@ fn test_concurrent_snapshot_wc_reloadable() {
[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 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
// a child of "child1", not of "initial".
let template = r#"commit_id ++ " " ++ description"#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template, "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", template, "-s"]);
insta::assert_snapshot!(output, @r"
@ 1795621b54f4ebb435978b65d66bc0f90d8f20b6 new child2
A child2
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(),
&["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"
[EOF]
"#);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
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
[EOF]
");
@ -76,10 +76,8 @@ fn test_config_list_table() {
"z"."with space"."function()" = 5
"#,
);
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-table"]);
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.y.foo = "abc"
test-table.y.bar = 123
@ -96,16 +94,16 @@ fn test_config_list_inline_table() {
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
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.y = 1
[EOF]
");
// 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"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-table.x"]);
insta::assert_snapshot!(output, @r"
test-table.x = true
[EOF]
");
@ -119,8 +117,8 @@ fn test_config_list_array() {
test-array = [1, "b", 3.4]
"#,
);
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-array"]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "test-array"]);
insta::assert_snapshot!(output, @r#"
test-array = [1, "b", 3.4]
[EOF]
"#);
@ -139,8 +137,8 @@ fn test_config_list_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"]);
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 = 1 }, { y = ["z"], z = { "key=with whitespace" = [] } }]
[EOF]
"#);
@ -182,8 +180,8 @@ bar
"#,
);
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "multiline"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "multiline"]);
insta::assert_snapshot!(output, @r"
multiline = '''
foo
bar
@ -191,9 +189,9 @@ bar
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
test_env.env_root(),
&[
[
"config",
"list",
"multiline",
@ -201,7 +199,7 @@ bar
"--config=multiline='single'",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
# multiline = '''
# foo
# bar
@ -237,8 +235,8 @@ fn test_config_list_layer() {
],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", "--user"]);
insta::assert_snapshot!(output, @r#"
test-key = "test-val"
test-layered-key = "test-original-val"
[EOF]
@ -256,14 +254,14 @@ fn test_config_list_layer() {
],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", "--user"]);
insta::assert_snapshot!(output, @r#"
test-key = "test-val"
[EOF]
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--repo"]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", "--repo"]);
insta::assert_snapshot!(output, @r#"
test-layered-key = "test-layered-val"
[EOF]
"#);
@ -277,11 +275,11 @@ fn test_config_layer_override_default() {
let config_key = "merge-tools.vimdiff.program";
// Default
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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"
[EOF]
"#);
@ -291,8 +289,8 @@ fn test_config_layer_override_default() {
"{config_key} = {value}\n",
value = to_toml_value("user")
));
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(output, @r#"
merge-tools.vimdiff.program = "user"
[EOF]
"#);
@ -303,16 +301,16 @@ fn test_config_layer_override_default() {
format!("{config_key} = {value}\n", value = to_toml_value("repo")),
)
.unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(output, @r#"
merge-tools.vimdiff.program = "repo"
[EOF]
"#);
// Command argument
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"config",
"list",
config_key,
@ -320,15 +318,15 @@ fn test_config_layer_override_default() {
&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"
[EOF]
"#);
// Allow printing overridden values
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"config",
"list",
config_key,
@ -337,16 +335,16 @@ fn test_config_layer_override_default() {
&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 = "repo"
merge-tools.vimdiff.program = "command-arg"
[EOF]
"##);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"config",
"list",
"--color=always",
@ -354,7 +352,7 @@ fn test_config_layer_override_default() {
"--include-overridden",
],
);
insta::assert_snapshot!(stdout, @r#"
insta::assert_snapshot!(output, @r#"
# merge-tools.vimdiff.program = "user"
merge-tools.vimdiff.program = "repo"
[EOF]
@ -370,8 +368,8 @@ fn test_config_layer_override_env() {
// Environment base
test_env.add_env_var("EDITOR", "env-base");
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(output, @r#"
ui.editor = "env-base"
[EOF]
"#);
@ -381,8 +379,8 @@ fn test_config_layer_override_env() {
"{config_key} = {value}\n",
value = to_toml_value("user")
));
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(output, @r#"
ui.editor = "user"
[EOF]
"#);
@ -393,24 +391,24 @@ fn test_config_layer_override_env() {
format!("{config_key} = {value}\n", value = to_toml_value("repo")),
)
.unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(output, @r#"
ui.editor = "repo"
[EOF]
"#);
// Environment override
test_env.add_env_var("JJ_EDITOR", "env-override");
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["config", "list", config_key]);
insta::assert_snapshot!(output, @r#"
ui.editor = "env-override"
[EOF]
"#);
// Command argument
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"config",
"list",
config_key,
@ -418,15 +416,15 @@ fn test_config_layer_override_env() {
&format!("{config_key}={value}", value = to_toml_value("command-arg")),
],
);
insta::assert_snapshot!(stdout, @r#"
insta::assert_snapshot!(output, @r#"
ui.editor = "command-arg"
[EOF]
"#);
// Allow printing overridden values
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"config",
"list",
config_key,
@ -435,7 +433,7 @@ fn test_config_layer_override_env() {
&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 = "user"
# ui.editor = "repo"
@ -469,13 +467,13 @@ fn test_config_layer_workspace() {
),
)
.unwrap();
let stdout = test_env.jj_cmd_success(&main_path, &["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&main_path, ["config", "list", config_key]);
insta::assert_snapshot!(output, @r#"
ui.editor = "main-repo"
[EOF]
"#);
let stdout = test_env.jj_cmd_success(&secondary_path, &["config", "list", config_key]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&secondary_path, ["config", "list", config_key]);
insta::assert_snapshot!(output, @r#"
ui.editor = "main-repo"
[EOF]
"#);
@ -931,7 +929,7 @@ fn test_config_path() {
test_env.set_config_path(&user_config_path);
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
[EOF]
");
@ -941,7 +939,7 @@ fn test_config_path() {
);
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
[EOF]
");
@ -999,14 +997,14 @@ fn test_config_get() {
[exit status: 1]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "table.string"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.string"]);
insta::assert_snapshot!(output, @r"
some value 1
[EOF]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "table.int"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.int"]);
insta::assert_snapshot!(output, @r"
123
[EOF]
");
@ -1033,9 +1031,8 @@ fn test_config_get() {
[exit status: 1]
");
let stdout =
test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "table.overridden"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "table.overridden"]);
insta::assert_snapshot!(output, @r"
bar
[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()'"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "a.'b()'"]);
insta::assert_snapshot!(output, @r"
a.'b()' = 0
[EOF]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'"]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'"]);
insta::assert_snapshot!(output, @r#"
'b c'.d = 1
'b c'.e."f[]" = 2
[EOF]
"#);
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'.d"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'.d"]);
insta::assert_snapshot!(output, @r"
'b c'.d = 1
[EOF]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'.e.'f[]'"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'b c'.e.'f[]'"]);
insta::assert_snapshot!(output, @r"
'b c'.e.'f[]' = 2
[EOF]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "'b c'.e.'f[]'"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "'b c'.e.'f[]'"]);
insta::assert_snapshot!(output, @r"
2
[EOF]
");
@ -1100,25 +1097,25 @@ fn test_config_path_syntax() {
");
// "-" and "_" are valid TOML keys
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "-"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "-"]);
insta::assert_snapshot!(output, @r"
- = 3
[EOF]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "_"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "_"]);
insta::assert_snapshot!(output, @r"
_ = 4
[EOF]
");
// "." requires quoting
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'.'"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "'.'"]);
insta::assert_snapshot!(output, @r"
'.' = 5
[EOF]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "'.'"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "'.'"]);
insta::assert_snapshot!(output, @r"
5
[EOF]
");
@ -1207,44 +1204,44 @@ fn test_config_conditional() {
.unwrap();
// get and list should refer to the resolved config
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "foo"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "foo"]);
insta::assert_snapshot!(output, @r"
global
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "get", "foo"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo1_path, ["config", "get", "foo"]);
insta::assert_snapshot!(output, @r"
repo1
[EOF]
");
// baz should be the same for `jj config get` and `jj config list`
// qux should be different
let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "get", "baz"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo1_path, ["config", "get", "baz"]);
insta::assert_snapshot!(output, @r"
config
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "get", "qux"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo1_path, ["config", "get", "qux"]);
insta::assert_snapshot!(output, @r"
get
[EOF]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "list", "--user"]);
insta::assert_snapshot!(output, @r"
foo = 'global'
baz = 'config'
qux = 'list'
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo1_path, ["config", "list", "--user"]);
insta::assert_snapshot!(output, @r"
foo = 'repo1'
baz = 'config'
qux = 'list'
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo2_path, &["config", "list", "--user"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo2_path, ["config", "list", "--user"]);
insta::assert_snapshot!(output, @r"
foo = 'repo2'
baz = 'config'
qux = 'list'
@ -1252,8 +1249,8 @@ fn test_config_conditional() {
");
// relative workspace path
let stdout = test_env.jj_cmd_success(&repo2_path, &["config", "list", "--user", "-R../repo1"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo2_path, ["config", "list", "--user", "-R../repo1"]);
insta::assert_snapshot!(output, @r"
foo = 'repo1'
baz = 'config'
qux = 'list'
@ -1341,13 +1338,13 @@ fn test_config_conditional_without_home_dir() {
)
.unwrap();
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "foo"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(test_env.env_root(), ["config", "get", "foo"]);
insta::assert_snapshot!(output, @r"
global
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["config", "get", "foo"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["config", "get", "foo"]);
insta::assert_snapshot!(output, @r"
repo
[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("something"), "changed").unwrap();
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
[EOF]
");

View File

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

View File

@ -97,9 +97,8 @@ fn test_describe() {
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
[EOF]
");
let stdout =
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(output, @r"
line1
line2
@ -125,9 +124,8 @@ fn test_describe() {
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
[EOF]
");
let stdout =
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(output, @r"
line1
line2
[EOF]
@ -191,9 +189,8 @@ fn test_describe() {
Parent commit : zzzzzzzz 00000000 (empty) (no description set)
[EOF]
");
let stdout =
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(output, @r"
description from editor
content of message from editor
@ -540,9 +537,8 @@ fn test_multiple_message_args() {
[EOF]
");
let stdout =
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(output, @r"
First Paragraph from CLI
Second Paragraph from CLI
@ -586,9 +582,8 @@ fn test_multiple_message_args() {
[EOF]
");
let stdout =
test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--no-graph", "-r@", "-Tdescription"]);
insta::assert_snapshot!(output, @r"
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("file4"), "1\n2\n3\n4\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(output, @r"
Modified regular file file2:
1 1: 1
2 2: 25
@ -45,8 +45,8 @@ fn test_diff_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=0"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--context=0"]);
insta::assert_snapshot!(output, @r"
Modified regular file file2:
1 1: 1
2 2: 25
@ -57,8 +57,8 @@ fn test_diff_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--color=debug"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--color=debug"]);
insta::assert_snapshot!(output, @r"
<<diff header::Modified regular file file2:>>
<<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::>>
@ -69,31 +69,31 @@ fn test_diff_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
M file2
R {file1 => file3}
C {file2 => file4}
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--types"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--types"]);
insta::assert_snapshot!(output, @r"
FF file2
FF {file1 => file3}
FF {file2 => file4}
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--types", "glob:file[12]"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--types", "glob:file[12]"]);
insta::assert_snapshot!(output, @r"
F- file1
FF file2
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "file1"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "file1"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
deleted file mode 100644
index 257cc5642c..0000000000
@ -104,8 +104,8 @@ fn test_diff_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file2 b/file2
index 94ebaf9001..1ffc51b472 100644
--- a/file2
@ -125,8 +125,8 @@ fn test_diff_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=0"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--context=0"]);
insta::assert_snapshot!(output, @r"
diff --git a/file2 b/file2
index 94ebaf9001..1ffc51b472 100644
--- a/file2
@ -145,8 +145,8 @@ fn test_diff_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--color=debug"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--color=debug"]);
insta::assert_snapshot!(output, @r"
<<diff file_header::diff --git a/file2 b/file2>>
<<diff file_header::index 94ebaf9001..1ffc51b472 100644>>
<<diff file_header::--- a/file2>>
@ -166,8 +166,8 @@ fn test_diff_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "--git"]);
insta::assert_snapshot!(output, @r"
M file2
R {file1 => file3}
C {file2 => file4}
@ -190,8 +190,8 @@ fn test_diff_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(output, @r"
file2 | 3 +--
{file1 => file3} | 0
{file2 => file4} | 0
@ -200,8 +200,8 @@ fn test_diff_basic() {
");
// Filter by glob pattern
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "glob:file[12]"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "glob:file[12]"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
[EOF]
@ -244,8 +244,8 @@ fn test_diff_empty() {
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(output, @r"
Added regular file file1:
(empty)
[EOF]
@ -253,15 +253,15 @@ fn test_diff_empty() {
test_env.jj_cmd_ok(&repo_path, &["new"]);
std::fs::remove_file(repo_path.join("file1")).unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(output, @r"
Removed regular file file1:
(empty)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(output, @r"
file1 | 0
1 file changed, 0 insertions(+), 0 deletions(-)
[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("file4")).unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@--"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-r@--"]);
insta::assert_snapshot!(output, @r"
Added executable file file1:
(empty)
Added executable file file2:
@ -310,8 +310,8 @@ fn test_diff_file_mode() {
(empty)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@-"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-r@-"]);
insta::assert_snapshot!(output, @r"
Executable file became non-executable at file1:
1: 2
Executable file became non-executable at file2:
@ -320,8 +320,8 @@ fn test_diff_file_mode() {
Non-executable file became executable at file4:
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-r@"]);
insta::assert_snapshot!(output, @r"
Removed regular file file1:
1 : 2
Removed regular file file2:
@ -333,8 +333,8 @@ fn test_diff_file_mode() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@--", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-r@--", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
new file mode 100755
index 0000000000..e69de29bb2
@ -357,8 +357,8 @@ fn test_diff_file_mode() {
index 0000000000..e69de29bb2
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@-", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-r@-", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
old mode 100755
new mode 100644
@ -384,8 +384,8 @@ fn test_diff_file_mode() {
new mode 100755
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-r@", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
deleted file mode 100644
index 0cfbf08886..0000000000
@ -497,7 +497,7 @@ fn test_diff_name_only() {
test_env.jj_cmd_ok(&repo_path, &["new"]);
std::fs::write(repo_path.join("deleted"), "d").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
modified
[EOF]
@ -508,8 +508,8 @@ fn test_diff_name_only() {
std::fs::write(repo_path.join("added"), "add").unwrap();
std::fs::create_dir(repo_path.join("sub")).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(),
@r"
insta::assert_snapshot!(
test_env.run_jj_in(&repo_path, ["diff", "--name-only"]).normalize_backslash(), @r"
added
deleted
modified
@ -575,9 +575,9 @@ fn test_diff_relative_paths() {
.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)]
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
Modified regular file file2:
1 1: foo2bar2
Modified regular file subdir1/file3:
@ -589,7 +589,7 @@ fn test_diff_relative_paths() {
[EOF]
");
#[cfg(windows)]
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
Modified regular file file2:
1 1: foo2bar2
Modified regular file subdir1\file3:
@ -601,9 +601,9 @@ fn test_diff_relative_paths() {
[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)]
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
M file2
M subdir1/file3
M ../dir2/file4
@ -611,7 +611,7 @@ fn test_diff_relative_paths() {
[EOF]
");
#[cfg(windows)]
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
M file2
M subdir1\file3
M ..\dir2\file4
@ -619,9 +619,9 @@ fn test_diff_relative_paths() {
[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)]
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
FF file2
FF subdir1/file3
FF ../dir2/file4
@ -629,7 +629,7 @@ fn test_diff_relative_paths() {
[EOF]
");
#[cfg(windows)]
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
FF file2
FF subdir1\file3
FF ..\dir2\file4
@ -637,8 +637,8 @@ fn test_diff_relative_paths() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path.join("dir1"), ["diff", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/dir1/file2 b/dir1/file2
index 54b060eee9..1fe912cdd8 100644
--- a/dir1/file2
@ -670,9 +670,9 @@ fn test_diff_relative_paths() {
[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)]
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
file2 | 2 +-
subdir1/file3 | 2 +-
../dir2/file4 | 2 +-
@ -681,7 +681,7 @@ fn test_diff_relative_paths() {
[EOF]
");
#[cfg(windows)]
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
file2 | 2 +-
subdir1\file3 | 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("file3"), "foo\nbar\nbaz quux blah blah\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(output, @r"
Modified regular file file1:
1: foo
Modified regular file file2:
@ -720,8 +720,8 @@ fn test_diff_hunks() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--color=debug"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--color=debug"]);
insta::assert_snapshot!(output, @r"
<<diff header::Modified regular file file1:>>
<<diff:: >><<diff added line_number:: 1>><<diff::: >><<diff added token::foo>>
<<diff header::Modified regular file file2:>>
@ -733,8 +733,8 @@ fn test_diff_hunks() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
index e69de29bb2..257cc5642c 100644
--- a/file1
@ -759,8 +759,8 @@ fn test_diff_hunks() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--color=debug"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--color=debug"]);
insta::assert_snapshot!(output, @r"
<<diff file_header::diff --git a/file1 b/file1>>
<<diff file_header::index e69de29bb2..257cc5642c 100644>>
<<diff file_header::--- a/file1>>
@ -905,8 +905,8 @@ fn test_diff_color_words_inlining_threshold() {
.unwrap();
// default
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(output, @r"
Modified regular file file1-single-line:
1 1: == adds ==
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("file2"), "foo").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(output, @r"
Modified regular file file1:
1 1: foo
2: bar
@ -1366,8 +1366,8 @@ fn test_diff_missing_newline() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
index 1910281566..a907ec3f43 100644
--- a/file1
@ -1391,8 +1391,8 @@ fn test_diff_missing_newline() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(output, @r"
file1 | 3 ++-
file2 | 3 +--
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();
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,
&[
[
"log",
"-Tdescription",
"-pr::@-",
@ -1433,7 +1433,7 @@ fn test_color_words_diff_missing_newline() {
"--reversed",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
=== Empty
Added regular file file1:
(empty)
@ -1501,9 +1501,9 @@ fn test_color_words_diff_missing_newline() {
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"--config=diff.color-words.max-inline-alternation=0",
"-Tdescription",
@ -1512,7 +1512,7 @@ fn test_color_words_diff_missing_newline() {
"--reversed",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
=== Empty
Added regular file file1:
(empty)
@ -1618,8 +1618,8 @@ fn test_diff_ignore_whitespace() {
test_env.jj_cmd_ok(&repo_path, &["status"]);
// Git diff as reference output
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--ignore-all-space"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--ignore-all-space"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
index f532aa68ad..033c4a6168 100644
--- a/file1
@ -1633,8 +1633,8 @@ fn test_diff_ignore_whitespace() {
baz { }
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--ignore-space-change"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--ignore-space-change"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
index f532aa68ad..033c4a6168 100644
--- a/file1
@ -1652,25 +1652,22 @@ fn test_diff_ignore_whitespace() {
");
// Diff-stat should respects the whitespace options
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat", "--ignore-all-space"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat", "--ignore-all-space"]);
insta::assert_snapshot!(output, @r"
file1 | 2 ++
1 file changed, 2 insertions(+), 0 deletions(-)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat", "--ignore-space-change"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat", "--ignore-space-change"]);
insta::assert_snapshot!(output, @r"
file1 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[EOF]
");
// Word-level changes are still highlighted
let stdout = test_env.jj_cmd_success(
&repo_path,
&["diff", "--color=always", "--ignore-all-space"],
);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--color=always", "--ignore-all-space"]);
insta::assert_snapshot!(output, @r"
Modified regular file file1:
 1: {
 1  2:  foo {
@ -1680,11 +1677,11 @@ fn test_diff_ignore_whitespace() {
 4  6: baz { }
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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:
 1: {
 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"]);
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,
&["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
Added regular file file1:
1: a
@ -1827,11 +1824,11 @@ context = 0
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();
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
Added regular file file1:
1: a
@ -1867,9 +1864,9 @@ context = 0
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();
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"-Tdescription",
"-p",
@ -1878,7 +1875,7 @@ context = 0
"--reversed",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
=== First commit
diff --git a/file1 b/file1
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"]);
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,
&[
[
"log",
"-Tdescription",
"-p",
@ -1935,7 +1932,7 @@ fn test_diff_skipped_context_nondefault() {
"--context=0",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
=== Left side of diffs
Added regular file file1:
1: a
@ -1993,8 +1990,8 @@ fn test_diff_leading_trailing_context() {
.unwrap();
// N=5 <= num_context_lines + 1: No room to skip.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=4"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--context=4"]);
insta::assert_snapshot!(output, @r"
Modified regular file file1:
1 1: 1
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
// trailing diff existed.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=3"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--context=3"]);
insta::assert_snapshot!(output, @r"
Modified regular file file1:
...
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
// if trailing diff existed.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=1"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--context=1"]);
insta::assert_snapshot!(output, @r"
Modified regular file file1:
...
5 5: 5
@ -2047,8 +2044,8 @@ fn test_diff_leading_trailing_context() {
");
// N=5 <= num_context_lines: No room to skip.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=5"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--context=5"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
index 1bf57dee4a..69b3e1865c 100644
--- 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
// trailing diff existed.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=3"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--context=3"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
index 1bf57dee4a..69b3e1865c 100644
--- 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
// if trailing diff existed.
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=2"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git", "--context=2"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
index 1bf57dee4a..69b3e1865c 100644
--- a/file1
@ -2164,7 +2161,7 @@ fn test_diff_external_tool() {
// diff without file patterns
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
file2
--
@ -2175,14 +2172,14 @@ fn test_diff_external_tool() {
// diff with file patterns
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
--
[EOF]
");
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
(no description set)
file1
@ -2201,7 +2198,7 @@ fn test_diff_external_tool() {
");
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
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
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
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
file2
--
@ -2231,7 +2228,7 @@ fn test_diff_external_tool() {
// Inlined command arguments
let command_toml = to_toml_value(fake_diff_editor_path());
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
file3
--
@ -2243,7 +2240,7 @@ fn test_diff_external_tool() {
// Output of external diff tool shouldn't be escaped
std::fs::write(&edit_script, "print \x1b[1;31mred").unwrap();
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"
red
[EOF]
@ -2424,7 +2421,7 @@ fn test_diff_external_tool_symlink() {
// Shouldn't try to change permission of symlinks
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
file
--
@ -2554,8 +2551,8 @@ fn test_diff_stat() {
let repo_path = test_env.env_root().join("repo");
std::fs::write(repo_path.join("file1"), "foo\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(output, @r"
file1 | 1 +
1 file changed, 1 insertion(+), 0 deletions(-)
[EOF]
@ -2563,8 +2560,8 @@ fn test_diff_stat() {
test_env.jj_cmd_ok(&repo_path, &["new"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(output, @r"
0 files changed, 0 insertions(+), 0 deletions(-)
[EOF]
");
@ -2573,8 +2570,8 @@ fn test_diff_stat() {
test_env.jj_cmd_ok(&repo_path, &["new"]);
std::fs::write(repo_path.join("file1"), "bar\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(output, @r"
file1 | 1 -
1 file changed, 0 insertions(+), 1 deletion(-)
[EOF]
@ -2727,8 +2724,8 @@ fn test_diff_binary() {
// 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();
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(output, @r"
Removed regular file file1.png:
(binary)
Modified regular file file2.png:
@ -2740,8 +2737,8 @@ fn test_diff_binary() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1.png b/file1.png
deleted file mode 100644
index 2b65b23c22..0000000000
@ -2760,8 +2757,8 @@ fn test_diff_binary() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--stat"]);
insta::assert_snapshot!(output, @r"
file1.png | 3 ---
file2.png | 5 ++---
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
don't make any changes, then the operation will be aborted.
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
[EOF]
@ -76,8 +76,8 @@ fn test_diffedit() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
[EOF]
@ -102,8 +102,8 @@ fn test_diffedit() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
[EOF]
@ -119,8 +119,8 @@ fn test_diffedit() {
[EOF]
[exit status: 1]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
[EOF]
@ -137,8 +137,8 @@ fn test_diffedit() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
[EOF]
");
@ -177,8 +177,8 @@ fn test_diffedit() {
Added 0 files, modified 0 files, removed 1 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
D file2
[EOF]
@ -210,8 +210,8 @@ fn test_diffedit_new_file() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
A file2
[EOF]
@ -228,8 +228,8 @@ fn test_diffedit_new_file() {
Added 1 files, modified 0 files, removed 0 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
M file1
A file2
[EOF]
@ -249,8 +249,8 @@ fn test_diffedit_new_file() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
A file2
[EOF]
@ -430,8 +430,8 @@ fn test_diffedit_external_tool_conflict_marker_style() {
"##);
// File should be conflicted with no changes
let stdout = test_env.jj_cmd_success(&repo_path, &["st"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["st"]);
insta::assert_snapshot!(output, @r"
The working copy has no changes.
Working copy : mzvwutvl fb39e804 (conflict) (empty) (no description set)
Parent commit: rlvkpnrz 3765cc27 side-a
@ -480,8 +480,8 @@ fn test_diffedit_3pane() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
[EOF]
@ -496,8 +496,8 @@ fn test_diffedit_3pane() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
[EOF]
@ -517,8 +517,8 @@ fn test_diffedit_3pane() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
[EOF]
");
@ -538,8 +538,8 @@ fn test_diffedit_3pane() {
Added 1 files, modified 0 files, removed 0 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
M file1
M file2
[EOF]
@ -557,8 +557,8 @@ fn test_diffedit_3pane() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
[EOF]
@ -590,8 +590,8 @@ fn test_diffedit_merge() {
std::fs::write(repo_path.join("file3"), "d\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["new"]);
// Test the setup
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r", "@-", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-r", "@-", "-s"]);
insta::assert_snapshot!(output, @r"
M file1
A file3
[EOF]
@ -617,15 +617,15 @@ fn test_diffedit_merge() {
file2 2-sided conflict
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
D file1
A file3
[EOF]
");
assert!(!repo_path.join("file1").exists());
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(output, @r"
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-a
@ -659,8 +659,8 @@ fn test_diffedit_old_restore_interactive_tests() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
C {file2 => file3}
@ -677,8 +677,8 @@ fn test_diffedit_old_restore_interactive_tests() {
[EOF]
[exit status: 1]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
M file2
C {file2 => file3}
@ -696,8 +696,8 @@ fn test_diffedit_old_restore_interactive_tests() {
Added 0 files, modified 1 files, removed 1 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
[EOF]
");
@ -714,8 +714,8 @@ fn test_diffedit_old_restore_interactive_tests() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(output, @r"
diff --git a/file1 b/file1
deleted file mode 100644
index 7898192261..0000000000
@ -769,8 +769,8 @@ fn test_diffedit_restore_descendants() {
Parent commit : rlvkpnrz 62b8c2ce (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r#"
let output = test_env.run_jj_in(&repo_path, ["diff", "--git"]);
insta::assert_snapshot!(output, @r#"
diff --git a/file b/file
index 1a598a8fc9..7b6a85ab5a 100644
--- 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()"]);
std::fs::write(repo_path.join("file1"), "resolved\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog"]);
insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description
× 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
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "evolog"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--color=always", "evolog"]);
insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description
× 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
// (even even though it resulted in a conflict).
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "-p"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog", "-p"]);
insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description
Resolved conflict in file1:
@ -84,8 +84,8 @@ fn test_evolog_with_or_without_diff() {
");
// Test `--limit`
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--limit=2"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog", "--limit=2"]);
insta::assert_snapshot!(output, @r"
@ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description
× 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`
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--no-graph"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog", "--no-graph"]);
insta::assert_snapshot!(output, @r"
rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description
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`
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--no-graph", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog", "--no-graph", "--git"]);
insta::assert_snapshot!(output, @r"
rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description
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();
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
my description
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict
@ -269,9 +269,8 @@ fn test_evolog_squash() {
],
);
let stdout =
test_env.jj_cmd_success(&repo_path, &["evolog", "-p", "-r", "description('squash')"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog", "-p", "-r", "description('squash')"]);
insta::assert_snapshot!(output, @r"
qpvuntsm test.user@example.com 2001-02-03 08:05:15 d49749bf
squashed 3
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", "b"]);
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "c"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--reversed", "--no-graph"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["evolog", "--reversed", "--no-graph"]);
insta::assert_snapshot!(output, @r"
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set)
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 d8d5f980
@ -383,11 +382,11 @@ fn test_evolog_reversed_no_graph() {
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
(empty) b
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",
],
);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
(empty) (no description set)
qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 d8d5f980
@ -441,11 +440,11 @@ fn test_evolog_reverse_with_graph() {
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
(empty) d
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"]);
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"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt"]);
insta::assert_snapshot!(output, @r"
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
[EOF]
@ -75,8 +75,8 @@ fn test_annotate_merge() {
)
.unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt"]);
insta::assert_snapshot!(output, @r"
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
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"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt"]);
insta::assert_snapshot!(output, @r"
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 3: %%%%%%% Changes from base to side #1
@ -146,8 +146,8 @@ fn test_annotate_merge_one_sided_conflict_resolution() {
)
.unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt"]);
insta::assert_snapshot!(output, @r"
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
[EOF]
@ -186,11 +186,8 @@ fn test_annotate_with_template() {
) ++ "\n") ++ pad_start(4, line_number) ++ ": " ++ content
"#};
let stdout = test_env.jj_cmd_success(
&repo_path,
&["file", "annotate", "file.txt", "-T", template],
);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "annotate", "file.txt", "-T", template]);
insta::assert_snapshot!(output, @r"
qpvuntsm initial
2001-02-03 08:05:08 Test User <test.user@example.com>
1: line1

View File

@ -72,14 +72,14 @@ fn test_chmod_regular_conflict() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["debug", "tree"]);
insta::assert_snapshot!(output,
@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 })]))
[EOF]
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file"]);
insta::assert_snapshot!(output,
@r"
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
@ -93,14 +93,14 @@ fn test_chmod_regular_conflict() {
// Test chmodding a conflict
test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "x", "file"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["debug", "tree"]);
insta::assert_snapshot!(output,
@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 })]))
[EOF]
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file"]);
insta::assert_snapshot!(output,
@r"
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
@ -112,14 +112,14 @@ fn test_chmod_regular_conflict() {
[EOF]
");
test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "n", "file"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["debug", "tree"]);
insta::assert_snapshot!(output,
@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 })]))
[EOF]
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file"]);
insta::assert_snapshot!(output,
@r"
<<<<<<< Conflict 1 of 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
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_dir"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["debug", "tree", "-r=file_dir"]);
insta::assert_snapshot!(output,
@r#"
file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(Tree(TreeId("133bb38fc4e4bf6b551f1f04db7e48f04cac2877")))]))
[EOF]
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_dir", "file"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=file_dir", "file"]);
insta::assert_snapshot!(output,
@r"
Conflict:
Removing file with id df967b96a579e45a18b8251732d16804b2e56a55
@ -216,14 +216,14 @@ fn test_chmod_file_dir_deletion_conflicts() {
");
// The file_deletion conflict can be chmod-ed
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_deletion"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["debug", "tree", "-r=file_deletion"]);
insta::assert_snapshot!(output,
@r#"
file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), None]))
[EOF]
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_deletion", "file"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=file_deletion", "file"]);
insta::assert_snapshot!(output,
@r"
<<<<<<< Conflict 1 of 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.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_deletion"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["debug", "tree", "-r=file_deletion"]);
insta::assert_snapshot!(output,
@r#"
file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), None]))
[EOF]
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_deletion", "file"]);
insta::assert_snapshot!(stdout,
let output = test_env.run_jj_in(&repo_path, ["file", "show", "-r=file_deletion", "file"]);
insta::assert_snapshot!(output,
@r"
<<<<<<< Conflict 1 of 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();
// Can print the contents of a file in a commit
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
a
[EOF]
");
// Defaults to printing the working-copy version
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(output, @r"
b
[EOF]
");
@ -46,8 +46,8 @@ fn test_show() {
} else {
"dir\\file2"
};
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", subdir_file]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", subdir_file]);
insta::assert_snapshot!(output, @r"
c
[EOF]
");
@ -62,15 +62,15 @@ fn test_show() {
");
// Can print files under the specified directory
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "dir"]);
insta::assert_snapshot!(output, @r"
c
[EOF]
");
// Can print multiple files
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "."]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "."]);
insta::assert_snapshot!(output, @r"
c
b
[EOF]
@ -92,8 +92,8 @@ fn test_show() {
test_env.jj_cmd_ok(&repo_path, &["new"]);
std::fs::write(repo_path.join("file1"), "c\n").unwrap();
test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "@", "-d", "@--"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(output, @r"
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
-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
// doesn't need to be ignored (because it won't be automatically added
// back).
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(output, @r"
file1
file2
[EOF]
@ -148,8 +148,8 @@ fn test_track_untrack_sparse() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "untrack", "file2"]);
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(output, @r"
file1
[EOF]
");
@ -158,8 +158,8 @@ fn test_track_untrack_sparse() {
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "track", "file2"]);
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(output, @r"
file1
[EOF]
");
@ -177,27 +177,27 @@ fn test_auto_track() {
std::fs::write(repo_path.join("file3.md"), "initial").unwrap();
// Only configured paths get auto-tracked
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(output, @r"
file1.rs
[EOF]
");
// Can manually track paths
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file3.md"]);
insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "track", "file3.md"]);
insta::assert_snapshot!(output, @"");
let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(output, @r"
file1.rs
file3.md
[EOF]
");
// Can manually untrack paths
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "untrack", "file3.md"]);
insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "untrack", "file3.md"]);
insta::assert_snapshot!(output, @"");
let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(output, @r"
file1.rs
[EOF]
");
@ -206,17 +206,17 @@ fn test_auto_track() {
let subdir = repo_path.join("sub");
std::fs::create_dir(&subdir).unwrap();
std::fs::write(subdir.join("file1.rs"), "initial").unwrap();
let stdout = test_env.jj_cmd_success(&subdir, &["file", "list"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&subdir, ["file", "list"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
../file1.rs
[EOF]
");
// But `jj file track` wants CWD-relative paths
let stdout = test_env.jj_cmd_success(&subdir, &["file", "track", "file1.rs"]);
insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&subdir, &["file", "list"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&subdir, ["file", "track", "file1.rs"]);
insta::assert_snapshot!(output, @"");
let output = test_env.run_jj_in(&subdir, ["file", "list"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
../file1.rs
file1.rs
[EOF]
@ -235,20 +235,20 @@ fn test_track_ignored() {
std::fs::write(repo_path.join("file1.bak"), "initial").unwrap();
// Track an unignored path
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file1"]);
insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "track", "file1"]);
insta::assert_snapshot!(output, @"");
let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(output, @r"
file1
[EOF]
");
// Track an ignored path
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file1.bak"]);
insta::assert_snapshot!(stdout, @"");
let output = test_env.run_jj_in(&repo_path, ["file", "track", "file1.bak"]);
insta::assert_snapshot!(output, @"");
// TODO: We should teach `jj file track` to track ignored paths (possibly
// requiring a flag)
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "list"]);
insta::assert_snapshot!(output, @r"
file1
[EOF]
");

View File

@ -62,8 +62,8 @@ fn test_config_no_tools() {
[exit status: 1]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
content
[EOF]
");
@ -95,18 +95,18 @@ fn test_config_multiple_tools() {
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(output, @r"
FOO
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(output, @r"
bar
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(output, @r"
Baz
[EOF]
");
@ -156,13 +156,13 @@ fn test_config_multiple_tools_with_same_name() {
");
test_env.set_config_path("/dev/null");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(output, @r"
Foo
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(output, @r"
Bar
[EOF]
");
@ -201,18 +201,18 @@ fn test_config_disabled_tools() {
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(output, @r"
FOO
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(output, @r"
bar
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(output, @r"
Baz
[EOF]
");
@ -274,19 +274,19 @@ fn test_config_tables_overlapping_patterns() {
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(output, @r"
foo
tool-1[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "bar", "-r", "@"]);
insta::assert_snapshot!(output, @r"
bar
tool-1
tool-2[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "baz", "-r", "@"]);
insta::assert_snapshot!(output, @r"
baz
tool-2[EOF]
");
@ -321,8 +321,8 @@ fn test_config_tables_all_commands_missing() {
[exit status: 1]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(output, @r"
foo
[EOF]
");
@ -361,8 +361,8 @@ fn test_config_tables_some_commands_missing() {
[exit status: 1]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(output, @r"
foo
[EOF]
");
@ -394,8 +394,8 @@ fn test_config_tables_empty_patterns_list() {
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo", "-r", "@"]);
insta::assert_snapshot!(output, @r"
foo
[EOF]
");
@ -431,18 +431,18 @@ fn test_config_filesets() {
let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a1", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "a1", "-r", "@"]);
insta::assert_snapshot!(output, @r"
A1
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b1", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "b1", "-r", "@"]);
insta::assert_snapshot!(output, @r"
1b
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b2", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "b2", "-r", "@"]);
insta::assert_snapshot!(output, @r"
2b
[EOF]
");
@ -473,33 +473,33 @@ fn test_relative_paths() {
// repo-relative, so this command fixes the empty intersection of those
// filesets.
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", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo1", "-r", "@"]);
insta::assert_snapshot!(output, @r"
unfixed
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(output, @r"
unfixed
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(output, @r"
unfixed
[EOF]
");
// 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 content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo1", "-r", "@"]);
insta::assert_snapshot!(content, @"Fixed![EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo1", "-r", "@"]);
insta::assert_snapshot!(output, @"Fixed![EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(output, @r"
unfixed
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(output, @r"
unfixed
[EOF]
");
@ -507,12 +507,12 @@ fn test_relative_paths() {
// The current directory does not change the interpretation of the config, so
// foo2 is fixed but not dir/foo3.
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", "@"]);
insta::assert_snapshot!(content, @"Fixed![EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(content, @"Fixed![EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo1", "-r", "@"]);
insta::assert_snapshot!(output, @"Fixed![EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "foo2", "-r", "@"]);
insta::assert_snapshot!(output, @"Fixed![EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "dir/foo3", "-r", "@"]);
insta::assert_snapshot!(output, @r"
unfixed
[EOF]
");
@ -546,10 +546,10 @@ fn test_fix_leaf_commit() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@-"]);
insta::assert_snapshot!(content, @"unaffected[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@-"]);
insta::assert_snapshot!(output, @"unaffected[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
AFFECTED
[EOF]
");
@ -577,18 +577,18 @@ fn test_fix_parent_commit() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "parent"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "parent"]);
insta::assert_snapshot!(output, @r"
PARENT
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "child1"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "child1"]);
insta::assert_snapshot!(output, @r"
CHILD1
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "child2"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "child2"]);
insta::assert_snapshot!(output, @r"
CHILD2
[EOF]
");
@ -612,15 +612,15 @@ fn test_fix_sibling_commit() {
Fixed 1 commits of 1 checked.
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "parent"]);
insta::assert_snapshot!(content, @"parent[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "child1"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "parent"]);
insta::assert_snapshot!(output, @"parent[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "child1"]);
insta::assert_snapshot!(output, @r"
CHILD1
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "child2"]);
insta::assert_snapshot!(content, @"child2[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "child2"]);
insta::assert_snapshot!(output, @"child2[EOF]");
}
#[test]
@ -658,24 +658,24 @@ fn test_default_revset() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "trunk1"]);
insta::assert_snapshot!(content, @"trunk1[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "trunk2"]);
insta::assert_snapshot!(content, @"trunk2[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "foo"]);
insta::assert_snapshot!(content, @"foo[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "bar1"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "trunk1"]);
insta::assert_snapshot!(output, @"trunk1[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "trunk2"]);
insta::assert_snapshot!(output, @"trunk2[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "foo"]);
insta::assert_snapshot!(output, @"foo[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "bar1"]);
insta::assert_snapshot!(output, @r"
BAR1
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "bar2"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "bar2"]);
insta::assert_snapshot!(output, @r"
BAR2
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "bar3"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "bar3"]);
insta::assert_snapshot!(output, @r"
BAR3
[EOF]
");
@ -702,10 +702,10 @@ fn test_custom_default_revset() {
Fixed 1 commits of 1 checked.
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "foo"]);
insta::assert_snapshot!(content, @"foo[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "bar"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "foo"]);
insta::assert_snapshot!(output, @"foo[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "bar"]);
insta::assert_snapshot!(output, @r"
BAR
[EOF]
");
@ -734,10 +734,10 @@ fn test_fix_immutable_commit() {
[EOF]
[exit status: 1]
"##);
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "immutable"]);
insta::assert_snapshot!(content, @"immutable[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "mutable"]);
insta::assert_snapshot!(content, @"mutable[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "immutable"]);
insta::assert_snapshot!(output, @"immutable[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "mutable"]);
insta::assert_snapshot!(output, @"mutable[EOF]");
}
#[test]
@ -752,8 +752,8 @@ fn test_fix_empty_file() {
Nothing changed.
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @"");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @"");
}
#[test]
@ -771,13 +771,13 @@ fn test_fix_some_paths() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file1"]);
insta::assert_snapshot!(output, @r"
FOO
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]);
insta::assert_snapshot!(content, @"bar[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file2"]);
insta::assert_snapshot!(output, @"bar[EOF]");
}
#[test]
@ -794,8 +794,8 @@ fn test_fix_cyclic() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
tnetnoc
[EOF]
");
@ -809,8 +809,8 @@ fn test_fix_cyclic() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
content
[EOF]
");
@ -845,23 +845,23 @@ fn test_deduplication() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "a"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "a"]);
insta::assert_snapshot!(output, @r"
FOO
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "b"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "b"]);
insta::assert_snapshot!(output, @r"
BAR
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "c"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "c"]);
insta::assert_snapshot!(output, @r"
BAR
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "d"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "d"]);
insta::assert_snapshot!(output, @r"
FOO
[EOF]
");
@ -896,8 +896,8 @@ fn test_executed_but_nothing_changed() {
Nothing changed.
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
content
[EOF]
");
@ -932,8 +932,8 @@ fn test_failure() {
Nothing changed.
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @"content[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @"content[EOF]");
}
#[test]
@ -953,8 +953,8 @@ fn test_stderr_success() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @"new content[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @"new content[EOF]");
}
#[test]
@ -970,8 +970,8 @@ fn test_stderr_failure() {
Nothing changed.
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @"old content[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @"old content[EOF]");
}
#[test]
@ -1012,8 +1012,8 @@ fn test_fix_file_types() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
CONTENT
[EOF]
");
@ -1038,8 +1038,8 @@ fn test_fix_executable() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
CONTENT
[EOF]
");
@ -1068,12 +1068,12 @@ fn test_fix_trivial_merge_commit() {
Nothing changed.
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_a", "-r", "@"]);
insta::assert_snapshot!(content, @"content a[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_b", "-r", "@"]);
insta::assert_snapshot!(content, @"content b[EOF]");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_c", "-r", "@"]);
insta::assert_snapshot!(content, @"content c[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_a", "-r", "@"]);
insta::assert_snapshot!(output, @"content a[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_b", "-r", "@"]);
insta::assert_snapshot!(output, @"content b[EOF]");
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_c", "-r", "@"]);
insta::assert_snapshot!(output, @"content c[EOF]");
}
#[test]
@ -1104,23 +1104,23 @@ fn test_fix_adding_merge_commit() {
Added 0 files, modified 4 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_a", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_a", "-r", "@"]);
insta::assert_snapshot!(output, @r"
CHANGE A
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_b", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_b", "-r", "@"]);
insta::assert_snapshot!(output, @r"
CHANGE B
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_c", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_c", "-r", "@"]);
insta::assert_snapshot!(output, @r"
CHANGE C
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file_d", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file_d", "-r", "@"]);
insta::assert_snapshot!(output, @r"
CHANGE D
[EOF]
");
@ -1150,18 +1150,18 @@ fn test_fix_both_sides_of_conflict() {
file 2-sided conflict
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "a"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "a"]);
insta::assert_snapshot!(output, @r"
CONTENT A
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "b"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "b"]);
insta::assert_snapshot!(output, @r"
CONTENT B
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
<<<<<<< Conflict 1 of 1
%%%%%%% Changes from base to side #1
+CONTENT A
@ -1196,8 +1196,8 @@ fn test_fix_resolve_conflict() {
Added 0 files, modified 1 files, removed 0 files
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "file", "-r", "@"]);
insta::assert_snapshot!(output, @r"
CONTENT
[EOF]
");
@ -1263,44 +1263,44 @@ fn test_all_files() {
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@-"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "a/a", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
parent aaa
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@-"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "b/b", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
parent bbb
fixed[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@-"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "c/c", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
parent ccc
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@-"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "ddd", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
parent ddd
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "a/a", "-r", "@"]);
insta::assert_snapshot!(output, @r"
child aaa
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "b/b", "-r", "@"]);
insta::assert_snapshot!(output, @r"
parent bbb
fixed[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "c/c", "-r", "@"]);
insta::assert_snapshot!(output, @r"
parent ccc
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "ddd", "-r", "@"]);
insta::assert_snapshot!(output, @r"
child ddd
[EOF]
");
@ -1316,46 +1316,46 @@ fn test_all_files() {
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@-"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "a/a", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
parent aaa
fixed[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@-"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "b/b", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
parent bbb
fixed
fixed[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@-"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "c/c", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
parent ccc
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@-"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "ddd", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
parent ddd
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "a/a", "-r", "@"]);
insta::assert_snapshot!(output, @r"
child aaa
fixed[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "b/b", "-r", "@"]);
insta::assert_snapshot!(output, @r"
parent bbb
fixed
fixed[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "c/c", "-r", "@"]);
insta::assert_snapshot!(output, @r"
parent ccc
[EOF]
");
let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@"]);
insta::assert_snapshot!(content, @r"
let output = test_env.run_jj_in(&repo_path, ["file", "show", "ddd", "-r", "@"]);
insta::assert_snapshot!(output, @r"
child ddd
[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"
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&test_env.env_root().join("clone1"),
&["config", "list", "--repo", "revset-aliases.'trunk()'"],
["config", "list", "--repo", "revset-aliases.'trunk()'"],
);
insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r#"
insta::assert_snapshot!(output, @r#"
revset-aliases.'trunk()' = "main@origin"
[EOF]
"#);
@ -646,12 +646,12 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) {
}
// "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"),
&["config", "list", "--repo", "revset-aliases.'trunk()'"],
["config", "list", "--repo", "revset-aliases.'trunk()'"],
);
insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r#"
insta::assert_snapshot!(output, @r#"
revset-aliases.'trunk()' = "feature1@origin"
[EOF]
"#);
@ -693,12 +693,12 @@ fn test_git_clone_remote_default_bookmark_with_escape(subprocess: bool) {
}
// "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"),
&["config", "list", "--repo", "revset-aliases.'trunk()'"],
["config", "list", "--repo", "revset-aliases.'trunk()'"],
);
insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r#"
insta::assert_snapshot!(output, @r#"
revset-aliases.'trunk()' = '"\""@origin'
[EOF]
"#);
@ -1171,9 +1171,9 @@ fn test_git_clone_malformed(subprocess: bool) {
insta::allow_duplicates! {
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::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
The working copy has no changes.
Working copy : zsuskuln f652c321 (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.
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.
Working copy : kkmpptxz fcdbbd73 (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.
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.
Working copy : royxmykx 0e146103 (empty) (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.
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.
Working copy : znkkpsqq 10dd328b (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"]);
insta::assert_snapshot!(stdout, @"");
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
(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"]);
insta::assert_snapshot!(stdout, @"");
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
(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"
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&test_env.env_root().join("repo"),
&["config", "list", "--repo", "revset-aliases.\"trunk()\""],
["config", "list", "--repo", "revset-aliases.\"trunk()\""],
);
insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r#"
insta::assert_snapshot!(output, @r#"
revset-aliases."trunk()" = "trunk@origin"
[EOF]
"#);
@ -658,8 +658,8 @@ fn test_git_init_colocated_dirty_working_copy() {
"#);
// Working-copy changes should have been snapshotted.
let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-s", "--ignore-working-copy"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&workspace_root, ["log", "-s", "--ignore-working-copy"]);
insta::assert_snapshot!(output, @r"
@ sqpuoqvx test.user@example.com 2001-02-03 08:05:07 36dbd9a1
(no description set)
C {some-file => new-staged-file}

View File

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

View File

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

View File

@ -45,11 +45,11 @@ fn test_gitsubmodule_print_gitmodules() {
)
.unwrap();
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&workspace_root,
&["git", "submodule", "print-gitmodules", "-r", "@-"],
["git", "submodule", "print-gitmodules", "-r", "@-"],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
name:old
url:https://github.com/old/old.git
path:old
@ -58,9 +58,8 @@ fn test_gitsubmodule_print_gitmodules() {
[EOF]
");
let stdout =
test_env.jj_cmd_success(&workspace_root, &["git", "submodule", "print-gitmodules"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&workspace_root, ["git", "submodule", "print-gitmodules"]);
insta::assert_snapshot!(output, @r"
name:new
url:https://github.com/new/new.git
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("file3"), "contents").unwrap();
let stdout = test_env.jj_cmd_success(&workspace_root, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&workspace_root, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
A .gitignore
A file0
A file3
@ -88,13 +88,13 @@ fn test_gitignores_relative_excludes_file_path() {
// core.excludesFile should be resolved relative to the workspace root, not
// to the cwd.
std::fs::create_dir(workspace_root.join("sub")).unwrap();
let stdout = test_env.jj_cmd_success(&workspace_root.join("sub"), &["diff", "-s"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&workspace_root.join("sub"), ["diff", "-s"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
A ../not-ignored
[EOF]
");
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["-Rrepo", "diff", "-s"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(test_env.env_root(), ["-Rrepo", "diff", "-s"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
A repo/not-ignored
[EOF]
");
@ -136,11 +136,11 @@ fn test_gitignores_ignored_file_in_target_commit() {
Discard the conflicting changes with `jj restore --from 5ada929e5d2e`.
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
index 8a69467466..4d9be5127b 100644
--- 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, &["new", "main-", "-m=c"]);
std::fs::write(repo_path.join("file"), "c").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log"]);
insta::assert_snapshot!(output, @r"
@ mzvwutvl test.user@example.com 2001-02-03 08:05:12 7adb43e8
c
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"]);
// implicit --to
let stdout = test_env.jj_cmd_success(&repo_path, &["interdiff", "--from", "left"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["interdiff", "--from", "left"]);
insta::assert_snapshot!(output, @r"
Modified regular file file2:
1 1: foo
2: bar
@ -42,11 +42,8 @@ fn test_interdiff_basic() {
// explicit --to
test_env.jj_cmd_ok(&repo_path, &["new", "@-"]);
let stdout = test_env.jj_cmd_success(
&repo_path,
&["interdiff", "--from", "left", "--to", "right"],
);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["interdiff", "--from", "left", "--to", "right"]);
insta::assert_snapshot!(output, @r"
Modified regular file file2:
1 1: foo
2: bar
@ -55,20 +52,20 @@ fn test_interdiff_basic() {
test_env.jj_cmd_ok(&repo_path, &["undo"]);
// formats specifiers
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
index 257cc5642c..3bd1f0e297 100644
--- a/file2
@ -101,19 +98,19 @@ fn test_interdiff_paths() {
std::fs::write(repo_path.join("file2"), "baz\n").unwrap();
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,
&["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:
1 1: barbaz
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"interdiff",
"--from",
"left",
@ -123,7 +120,7 @@ fn test_interdiff_paths() {
"file2",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
Modified regular file file1:
1 1: barbaz
Modified regular file file2:
@ -149,11 +146,11 @@ fn test_interdiff_conflicting() {
std::fs::write(repo_path.join("file"), "def\n").unwrap();
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,
&["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
index 0000000000..24c5735c3e 100644
--- 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"]);
std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ a new commit
add a file
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-p"]);
insta::assert_snapshot!(output, @r"
@ a new commit
Modified regular file file1:
1 1: foo
@ -98,16 +98,16 @@ fn test_log_with_or_without_diff() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--no-graph"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--no-graph"]);
insta::assert_snapshot!(output, @r"
a new commit
add a file
[EOF]
");
// `-p` for default diff output, `-s` for summary
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-p", "-s"]);
insta::assert_snapshot!(output, @r"
@ a new commit
M 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`)
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-s", "--git"]);
insta::assert_snapshot!(output, @r"
@ a new commit
M 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
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"-T",
"description",
@ -158,7 +158,7 @@ fn test_log_with_or_without_diff() {
"--config=ui.diff.format=summary",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ a new commit
M file1
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
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
Modified regular file file1:
1 1: foo
@ -185,11 +185,11 @@ fn test_log_with_or_without_diff() {
");
// `--git` enables git diff, so `-p` is noop
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
diff --git a/file1 b/file1
index 257cc5642c..3bd1f0e297 100644
@ -234,8 +234,8 @@ fn test_log_with_or_without_diff() {
");
// `-s` with or without graph
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-s"]);
insta::assert_snapshot!(output, @r"
@ a new commit
M file1
add a file
@ -243,11 +243,8 @@ fn test_log_with_or_without_diff() {
[EOF]
");
let stdout = test_env.jj_cmd_success(
&repo_path,
&["log", "-T", "description", "--no-graph", "-s"],
);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--no-graph", "-s"]);
insta::assert_snapshot!(output, @r"
a new commit
M file1
add a file
@ -256,11 +253,8 @@ fn test_log_with_or_without_diff() {
");
// `--git` implies `-p`, with or without graph
let stdout = test_env.jj_cmd_success(
&repo_path,
&["log", "-T", "description", "-r", "@", "--git"],
);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-r", "@", "--git"]);
insta::assert_snapshot!(output, @r"
@ a new commit
diff --git a/file1 b/file1
~ index 257cc5642c..3bd1f0e297 100644
@ -271,11 +265,11 @@ fn test_log_with_or_without_diff() {
+bar
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
diff --git a/file1 b/file1
index 257cc5642c..3bd1f0e297 100644
@ -288,20 +282,20 @@ fn test_log_with_or_without_diff() {
");
// `--color-words` 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", "@", "--color-words"],
["log", "-T", "description", "-r", "@", "--color-words"],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ a new commit
Modified regular file file1:
~ 1 1: foo
2: bar
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"-T",
"description",
@ -311,7 +305,7 @@ fn test_log_with_or_without_diff() {
"--color-words",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
a new commit
Modified regular file file1:
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, &["bookmark", "c", "-r@", "original"]);
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"
@ Change qpvuntsmwlqt initial e0e22b9fae75 original
@ -571,7 +565,7 @@ fn test_log_prefix_highlight_styled() {
}
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"
Change qpvuntsmwlqt initial e0e22b9fae75 original
@ -579,9 +573,9 @@ fn test_log_prefix_highlight_styled() {
[EOF]
"
);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"--color=always",
"log",
"-r",
@ -590,7 +584,7 @@ fn test_log_prefix_highlight_styled() {
&prefix_format(Some(12)),
],
);
insta::assert_snapshot!(stdout,
insta::assert_snapshot!(output,
@r"
@ Change wqnwkozpkust commit9 ede204633421
Change kmkuslswpqwq commit8 ef3d013266cd
@ -606,9 +600,9 @@ fn test_log_prefix_highlight_styled() {
[EOF]
"
);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"--color=always",
"log",
"-r",
@ -617,7 +611,7 @@ fn test_log_prefix_highlight_styled() {
&prefix_format(Some(3)),
],
);
insta::assert_snapshot!(stdout,
insta::assert_snapshot!(output,
@r"
@ Change wqn commit9 ede
Change kmk commit8 ef3
@ -633,9 +627,9 @@ fn test_log_prefix_highlight_styled() {
[EOF]
"
);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"--color=always",
"log",
"-r",
@ -644,7 +638,7 @@ fn test_log_prefix_highlight_styled() {
&prefix_format(None),
],
);
insta::assert_snapshot!(stdout,
insta::assert_snapshot!(output,
@r"
@ Change wq commit9 ed
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, &["bookmark", "c", "-r@", "original"]);
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"
@ Change q[pvuntsmwlqt] initial e0[e22b9fae75] original
Change z[zzzzzzzzzzz] 0[00000000000]
@ -707,7 +701,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() {
// The unique prefixes became longer.
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"
@ Change wq[nwkozpkust] 44[4c3c5066d3]
Change qpv[untsmwlqt] initial e0e[22b9fae75] original
@ -726,7 +720,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() {
"
);
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"
@ Change wq[nwkozpkust] 44[4c3c5066d3]
@ -776,7 +770,7 @@ fn test_log_author_format() {
let repo_path = test_env.env_root().join("repo");
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["log", "--revisions=@"]),
test_env.run_jj_in(&repo_path, ["log", "--revisions=@"]),
@r"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set)
@ -787,9 +781,9 @@ fn test_log_author_format() {
let decl = "template-aliases.'format_short_signature(signature)'";
insta::assert_snapshot!(
test_env.jj_cmd_success(
test_env.run_jj_in(
&repo_path,
&[
[
"--config",
&format!("{decl}='signature.email().local()'"),
"log",
@ -814,9 +808,9 @@ fn test_log_divergence() {
std::fs::write(repo_path.join("file"), "foo\n").unwrap();
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
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(output, @r"
@ description 1
[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, &["new", "-m", "second"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--reversed"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--reversed"]);
insta::assert_snapshot!(output, @r"
first
@ second
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
second
[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("file2"), "baz\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "file1"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "file1"]);
insta::assert_snapshot!(output, @r"
@ second
first
@ -890,16 +884,16 @@ fn test_log_filtered_by_path() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "file2"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "file2"]);
insta::assert_snapshot!(output, @r"
@ second
~
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s", "file1"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "-s", "file1"]);
insta::assert_snapshot!(output, @r"
@ second
M file1
first
@ -908,19 +902,19 @@ fn test_log_filtered_by_path() {
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
A file2
[EOF]
");
// empty revisions are filtered out by "all()" fileset.
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-Tdescription", "-s", "all()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-Tdescription", "-s", "all()"]);
insta::assert_snapshot!(output, @r"
@ second
M file1
A file2
@ -931,9 +925,9 @@ fn test_log_filtered_by_path() {
");
// "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(),
&[
[
"log",
"-R",
repo_path.to_str().unwrap(),
@ -942,7 +936,7 @@ fn test_log_filtered_by_path() {
"root:file1",
],
);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
insta::assert_snapshot!(output.normalize_backslash(), @r"
@ second
M repo/file1
first
@ -952,9 +946,9 @@ fn test_log_filtered_by_path() {
");
// files() revset doesn't filter the diff.
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"-T",
"description",
@ -963,7 +957,7 @@ fn test_log_filtered_by_path() {
"--no-graph",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
second
M file1
A file2
@ -988,8 +982,8 @@ fn test_log_limit() {
&["new", "-m", "d", "description(c)", "description(b)"],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--limit=3"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--limit=3"]);
insta::assert_snapshot!(output, @r"
@ d
b
@ -999,19 +993,19 @@ fn test_log_limit() {
");
// Applied on sorted DAG
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--limit=2"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description", "--limit=2"]);
insta::assert_snapshot!(output, @r"
@ d
b
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
c
[EOF]
@ -1019,20 +1013,20 @@ fn test_log_limit() {
// Applied on reversed DAG: Because the node "a" is omitted, "b" and "c" are
// rendered as roots.
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
b
@ d
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"-T",
"description",
@ -1041,7 +1035,7 @@ fn test_log_limit() {
"--no-graph",
],
);
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
b
c
d
@ -1049,11 +1043,11 @@ fn test_log_limit() {
");
// Applied on filtered commits
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
~
@ -1145,7 +1139,7 @@ fn test_default_revset() {
// The default revset is not used if a path is specified
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"
@ add a file
@ -1193,7 +1187,7 @@ fn test_multiple_revsets() {
test_env.add_config(r#"revsets.log = "root()""#);
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"
foo
@ -1201,7 +1195,7 @@ fn test_multiple_revsets() {
[EOF]
");
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"
@ baz
bar
@ -1211,7 +1205,7 @@ fn test_multiple_revsets() {
[EOF]
");
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"
foo
@ -1242,8 +1236,8 @@ fn test_graph_template_color() {
// First test without color for comparison
let template = r#"label(if(current_working_copy, "working_copy"), description)"#;
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", template]);
insta::assert_snapshot!(output, @r"
@ single line
first line
second line
@ -1251,8 +1245,8 @@ fn test_graph_template_color() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "log", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--color=always", "log", "-T", template]);
insta::assert_snapshot!(output, @r"
@ single line
first line
second line
@ -1260,8 +1254,8 @@ fn test_graph_template_color() {

[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["--color=debug", "log", "-T", template]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["--color=debug", "log", "-T", template]);
insta::assert_snapshot!(output, @r"
<<node working_copy::@>> <<log working_copy description::single line>>
<<node::>> <<log description::first line>>
<<log description::second line>>
@ -1297,8 +1291,8 @@ fn test_graph_styles() {
);
// Default (curved) style
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(output, @r"
@ merge
side bookmark
@ -1315,8 +1309,8 @@ fn test_graph_styles() {
// ASCII style
test_env.add_config(r#"ui.graph.style = "ascii""#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(output, @r"
@ merge
|\
| o side bookmark
@ -1333,8 +1327,8 @@ fn test_graph_styles() {
// Large ASCII style
test_env.add_config(r#"ui.graph.style = "ascii-large""#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(output, @r"
@ merge
|\
| \
@ -1353,8 +1347,8 @@ fn test_graph_styles() {
// Curved style
test_env.add_config(r#"ui.graph.style = "curved""#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(output, @r"
@ merge
side bookmark
@ -1371,8 +1365,8 @@ fn test_graph_styles() {
// Square style
test_env.add_config(r#"ui.graph.style = "square""#);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T=description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T=description"]);
insta::assert_snapshot!(output, @r"
@ merge
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,
&["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
(empty) this is commit with a multiline description

View File

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

View File

@ -29,8 +29,8 @@ fn test_op_log() {
let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
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
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
args: jj describe -m 'description 0'
@ -39,7 +39,7 @@ fn test_op_log() {
000000000000 root()
[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();
// Can load the repo at a specific operation ID
@ -76,8 +76,8 @@ fn test_op_log() {
[exit status: 1]
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--op-diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--op-diff"]);
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
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
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");
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,
&[
[
"op",
"log",
"--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
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
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"]);
let repo_path = test_env.env_root().join("repo");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-Tdescription", "--limit=1"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "-Tdescription", "--limit=1"]);
insta::assert_snapshot!(output, @r"
@ add workspace 'default'
[EOF]
");
@ -193,17 +193,16 @@ fn test_op_log_no_graph() {
test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]);
let repo_path = test_env.env_root().join("repo");
let stdout =
test_env.jj_cmd_success(&repo_path, &["op", "log", "--no-graph", "--color=always"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--no-graph", "--color=always"]);
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
add workspace 'default'
000000000000 root()
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--op-diff", "--no-graph"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--op-diff", "--no-graph"]);
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
add workspace 'default'
@ -221,8 +220,8 @@ fn test_op_log_reversed() {
let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 0"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--reversed"]);
insta::assert_snapshot!(output, @r"
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
add workspace 'default'
@ -260,8 +259,8 @@ fn test_op_log_reversed() {
");
// Should work correctly with `--no-graph`
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed", "--no-graph"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--reversed", "--no-graph"]);
insta::assert_snapshot!(output, @r"
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
add workspace 'default'
@ -278,8 +277,8 @@ fn test_op_log_reversed() {
");
// Should work correctly with `--limit`
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--reversed", "--limit=3"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--reversed", "--limit=3"]);
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
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
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`
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
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 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
commit 81a4ef3dd421f3184289df1c58bd3a16ea1e3d8e
args: jj commit -m 'commit 2'
@ -594,12 +593,12 @@ fn test_op_abandon_ancestors() {
[EOF]
");
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 tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
[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
commit 81a4ef3dd421f3184289df1c58bd3a16ea1e3d8e
args: jj commit -m 'commit 2'
@ -616,7 +615,7 @@ fn test_op_abandon_ancestors() {
Abandoned 2 operations and reparented 1 descendant operations.
[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
commit c5f7dd51add0046405055336ef443f882a0a8968
args: jj commit -m 'commit 5'
@ -654,12 +653,12 @@ fn test_op_abandon_ancestors() {
[EOF]
");
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 tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
[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
undo operation d92d0753399f732e438bdd88fa7e5214cba2a310d120ec1714028a514c7116bcf04b4a0b26c04dbecf0a917f1d4c8eb05571b8816dd98b0502aaf321e92500b3
args: jj undo
@ -676,7 +675,7 @@ fn test_op_abandon_ancestors() {
Nothing changed.
[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
undo operation d92d0753399f732e438bdd88fa7e5214cba2a310d120ec1714028a514c7116bcf04b4a0b26c04dbecf0a917f1d4c8eb05571b8816dd98b0502aaf321e92500b3
args: jj undo
@ -704,13 +703,13 @@ fn test_op_abandon_without_updating_working_copy() {
[EOF]
");
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 tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
[EOF]
"#);
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
commit 220cb0b1b5d1c03cc0d351139d824598bb3c1967
args: jj commit -m 'commit 3'
@ -727,13 +726,13 @@ fn test_op_abandon_without_updating_working_copy() {
[EOF]
");
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 tree: Merge(Resolved(TreeId("4b825dc642cb6eb9a060e54bf8d69288fbee4904")))
[EOF]
"#);
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
commit 220cb0b1b5d1c03cc0d351139d824598bb3c1967
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
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"op",
"diff",
"--from",
@ -969,7 +968,7 @@ fn test_op_summary_diff_template() {
"--color=always",
],
);
insta::assert_snapshot!(&stdout, @r"
insta::assert_snapshot!(output, @r"
From operation: 000000000000 root()
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>>
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"op",
"diff",
"--from",
@ -998,7 +997,7 @@ fn test_op_summary_diff_template() {
"--color=debug",
],
);
insta::assert_snapshot!(&stdout, @r"
insta::assert_snapshot!(output, @r"
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>>
@ -1017,8 +1016,8 @@ fn test_op_diff() {
let repo_path = test_env.env_root().join("repo");
// Overview of op log.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
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
check out git remote's default branch
args: jj git clone git-repo repo
@ -1032,17 +1031,17 @@ fn test_op_diff() {
");
// Diff between the same operation should be empty.
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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()
To operation: 000000000000 root()
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--from", "@", "--to", "@"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--from", "@", "--to", "@"]);
insta::assert_snapshot!(output, @r"
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
[EOF]
@ -1051,8 +1050,8 @@ fn test_op_diff() {
// Diff from parent operation to latest operation.
// `jj op diff --op @` should behave identically to `jj op diff --from
// @- --to @` (if `@` is not a merge commit).
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--from", "@-", "--to", "@"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--from", "@-", "--to", "@"]);
insta::assert_snapshot!(output, @r"
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
@ -1071,12 +1070,12 @@ fn test_op_diff() {
- untracked pukowqtp 0cb7e07e bookmark-1 | Commit 1
[EOF]
");
let stdout_without_from_to = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
assert_eq!(stdout.raw(), stdout_without_from_to.raw());
let output_without_from_to = test_env.run_jj_in(&repo_path, ["op", "diff"]).success();
assert_eq!(output.stdout.raw(), output_without_from_to.stdout.raw());
// Diff from root operation to latest operation
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--from", "0000000"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--from", "0000000"]);
insta::assert_snapshot!(output, @r"
From operation: 000000000000 root()
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
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--to", "0000000"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--to", "0000000"]);
insta::assert_snapshot!(output, @r"
From operation: 364d0a677b0c (2001-02-03 08:05:07) check out git remote's default branch
To operation: 000000000000 root()
@ -1152,8 +1151,8 @@ fn test_op_diff() {
Concurrent modification detected, resolving automatically.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
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
reconcile divergent operations
args: jj log
@ -1171,17 +1170,17 @@ fn test_op_diff() {
000000000000 root()
[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 first_parent_id = op_log_lines[3].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.
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
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
// operation.
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&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
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.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(output, @r"
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
@ -1279,8 +1278,8 @@ fn test_op_diff() {
Created 1 bookmarks pointing to kulxwnxm e1a239a5 bookmark-2 bookmark-2@origin | Commit 5
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(output, @r"
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
@ -1300,8 +1299,8 @@ fn test_op_diff() {
Started tracking 1 remote bookmarks.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(output, @r"
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
@ -1323,8 +1322,8 @@ fn test_op_diff() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(output, @r"
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
@ -1348,8 +1347,8 @@ fn test_op_diff() {
Added 1 files, modified 0 files, removed 0 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(output, @r"
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
@ -1368,8 +1367,8 @@ fn test_op_diff() {
Moved 1 bookmarks to wvuyspvk fefb1e17 bookmark-1* | (empty) new commit
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(output, @r"
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
@ -1389,8 +1388,8 @@ fn test_op_diff() {
Deleted 1 bookmarks.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(output, @r"
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
@ -1414,8 +1413,8 @@ fn test_op_diff() {
Parent commit : wvuyspvk fefb1e17 bookmark-1 | (empty) new commit
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff"]);
insta::assert_snapshot!(output, @r"
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
@ -1448,8 +1447,8 @@ fn test_op_diff_patch() {
Parent commit : qpvuntsm 6b1027d2 (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--op", "@-", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--op", "@-", "-p", "--git"]);
insta::assert_snapshot!(output, @r"
From operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default'
To operation: 187a5a9d8a22 (2001-02-03 08:05:08) snapshot working copy
@ -1465,8 +1464,8 @@ fn test_op_diff_patch() {
+a
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "--op", "@", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff", "--op", "@", "-p", "--git"]);
insta::assert_snapshot!(output, @r"
From operation: 187a5a9d8a22 (2001-02-03 08:05:08) snapshot working copy
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)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff", "-p", "--git"]);
insta::assert_snapshot!(output, @r"
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
@ -1520,8 +1519,8 @@ fn test_op_diff_patch() {
Parent commit : qpvuntsm 2ac85fd1 (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "diff", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "diff", "-p", "--git"]);
insta::assert_snapshot!(output, @r"
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
@ -1604,9 +1603,9 @@ fn test_op_diff_sibling() {
// Diff between p1 and p2 operations should work no matter if p2 is chosen
// as a base operation.
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"op",
"diff",
"--at-op",
@ -1618,7 +1617,7 @@ fn test_op_diff_sibling() {
"--summary",
],
);
insta::assert_snapshot!(&stdout, @r"
insta::assert_snapshot!(output, @r"
From operation: d700dc16fded (2001-02-03 08:05:11) new empty commit
To operation: 13b143e1f4f9 (2001-02-03 08:05:12) describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
@ -1632,9 +1631,9 @@ fn test_op_diff_sibling() {
A file2
[EOF]
");
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"op",
"diff",
"--at-op",
@ -1646,7 +1645,7 @@ fn test_op_diff_sibling() {
"--summary",
],
);
insta::assert_snapshot!(&stdout, @r"
insta::assert_snapshot!(output, @r"
From operation: 13b143e1f4f9 (2001-02-03 08:05:12) describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
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");
// Overview of op log.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
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
check out git remote's default branch
args: jj git clone git-repo repo
@ -1821,15 +1820,15 @@ fn test_op_show() {
");
// The root operation is empty.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "0000000"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show", "0000000"]);
insta::assert_snapshot!(output, @r"
000000000000 root()
[EOF]
");
// Showing the latest operation.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "@"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show", "@"]);
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
check out git remote's default branch
args: jj git clone git-repo repo
@ -1850,12 +1849,12 @@ fn test_op_show() {
[EOF]
");
// `jj op show @` should behave identically to `jj op show`.
let stdout_without_op_id = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
assert_eq!(stdout.raw(), stdout_without_op_id.raw());
let output_without_op_id = test_env.run_jj_in(&repo_path, ["op", "show"]).success();
assert_eq!(output.stdout.raw(), output_without_op_id.stdout.raw());
// Showing a given operation.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "@-"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show", "@-"]);
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
fetch from git remote into empty repo
args: jj git clone git-repo repo
@ -1897,8 +1896,8 @@ fn test_op_show() {
[EOF]
");
// Showing a merge operation is empty.
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
reconcile divergent operations
args: jj log
@ -1917,8 +1916,8 @@ fn test_op_show() {
Abandoned 1 commits that are no longer reachable.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
fetch from git remote(s) origin
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
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
create bookmark bookmark-2 pointing to commit e1a239a57eb15cefc5910198befbbbe2b43c47af
args: jj bookmark create bookmark-2 -r bookmark-2@origin
@ -1987,8 +1986,8 @@ fn test_op_show() {
Started tracking 1 remote bookmarks.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
track remote bookmark bookmark-2@origin
args: jj bookmark track bookmark-2@origin
@ -2010,8 +2009,8 @@ fn test_op_show() {
Nothing changed.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
track remote bookmark 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
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
new empty 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
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
point bookmark bookmark-1 to commit 560df364f0a09fe29f6a4fca8bd07c4464c7feee
args: jj bookmark set bookmark-1 -r @
@ -2079,8 +2078,8 @@ fn test_op_show() {
Deleted 1 bookmarks.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
delete bookmark 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
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show"]);
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
push all tracked bookmarks to git remote origin
args: jj git push --tracked
@ -2140,8 +2139,8 @@ fn test_op_show_patch() {
Parent commit : qpvuntsm 6b1027d2 (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "@-", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show", "@-", "-p", "--git"]);
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
snapshot working copy
args: jj new
@ -2158,8 +2157,8 @@ fn test_op_show_patch() {
+a
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "@", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show", "@", "-p", "--git"]);
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
new empty commit
args: jj new
@ -2178,8 +2177,8 @@ fn test_op_show_patch() {
Parent commit : qpvuntsm 2ac85fd1 (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show", "-p", "--git"]);
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
squash commits into 6b1027d2770cd0a39c468e525e52bf8c47e1464a
args: jj squash
@ -2215,8 +2214,8 @@ fn test_op_show_patch() {
Parent commit : qpvuntsm 2ac85fd1 (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "show", "-p", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "show", "-p", "--git"]);
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
abandon commit 9f4fb57fba25a7b47ce5980a5d9a4766778331e8
args: jj abandon
@ -2228,8 +2227,8 @@ fn test_op_show_patch() {
");
// Try again with "op log".
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--git"]);
insta::assert_snapshot!(&stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log", "--git"]);
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
abandon commit 9f4fb57fba25a7b47ce5980a5d9a4766778331e8
args: jj abandon

View File

@ -2811,7 +2811,7 @@ fn test_rebase_skip_emptied() {
let setup_opid = test_env.current_operation_id(&repo_path);
// 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
already 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
// 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
already empty
b
@ -2845,7 +2845,7 @@ fn test_rebase_skip_emptied() {
test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]);
// 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
already 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
// 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
already empty
b
@ -2903,7 +2903,7 @@ fn test_rebase_skip_emptied_descendants() {
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "also already empty"]);
// 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
already 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
// 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
already empty
c (will become empty)

View File

@ -71,7 +71,7 @@ fn test_resolution() {
[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"
file 2-sided conflict
[EOF]
@ -108,7 +108,7 @@ fn test_resolution() {
insta::assert_snapshot!(
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"
diff --git a/file b/file
index 0000000000..88425ec521 100644
@ -152,7 +152,7 @@ fn test_resolution() {
Added 0 files, modified 1 files, removed 0 files
[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"
diff --git a/file b/file
index 0000000000..88425ec521 100644
@ -179,7 +179,7 @@ fn test_resolution() {
// Check that the output file starts with conflict markers if
// `merge-tool-edits-conflict-markers=true`
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(
&editor_script,
@ -203,7 +203,7 @@ fn test_resolution() {
b
>>>>>>> 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"
diff --git a/file b/file
index 0000000000..88425ec521 100644
@ -224,7 +224,7 @@ fn test_resolution() {
// Check that if merge tool leaves conflict markers in output file and
// `merge-tool-edits-conflict-markers=true`, these markers are properly parsed.
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(
&editor_script,
@ -280,7 +280,7 @@ fn test_resolution() {
>>>>>>> Conflict 1 of 1 ends
"###);
// 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"
diff --git a/file b/file
--- a/file
@ -298,7 +298,7 @@ fn test_resolution() {
>>>>>>> Conflict 1 of 1 ends
[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"
file 2-sided conflict
[EOF]
@ -308,7 +308,7 @@ fn test_resolution() {
// `merge-tool-edits-conflict-markers=false` or is not specified,
// `jj` considers the conflict resolved.
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(
&editor_script,
@ -342,7 +342,7 @@ fn test_resolution() {
std::fs::read_to_string(test_env.env_root().join("editor3")).unwrap(), @r###"
"###);
// 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"
diff --git a/file b/file
index 0000000000..0610716cc1 100644
@ -375,7 +375,7 @@ fn test_resolution() {
// Check that merge tool can override conflict marker style setting, and that
// the merge tool can output Git-style conflict markers
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(
&editor_script,
@ -431,7 +431,7 @@ fn test_resolution() {
b
>>>>>>> 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"
diff --git a/file b/file
--- a/file
@ -449,7 +449,7 @@ fn test_resolution() {
>>>>>>> Conflict 1 of 1 ends
[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"
file 2-sided conflict
[EOF]
@ -459,7 +459,7 @@ fn test_resolution() {
// when using `merge-conflict-exit-codes = [1]`. The Git "diff3" conflict
// markers should also be parsed correctly.
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(
&editor_script,
@ -507,7 +507,7 @@ fn test_resolution() {
");
insta::assert_snapshot!(
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"
diff --git a/file b/file
--- a/file
@ -525,7 +525,7 @@ fn test_resolution() {
>>>>>>> Conflict 1 of 1 ends
[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"
file 2-sided conflict
[EOF]
@ -534,7 +534,7 @@ fn test_resolution() {
// 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.
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(
&editor_script,
@ -622,7 +622,7 @@ fn test_normal_conflict_input_files() {
[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"
file 2-sided conflict
[EOF]
@ -665,7 +665,7 @@ fn test_baseless_conflict_input_files() {
[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"
file 2-sided conflict
[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, "c", &["base"], &[("file", "c\n")]);
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"
file 3-sided conflict
[EOF]
");
// 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"
file 3-sided conflict
[EOF]
@ -752,13 +752,13 @@ fn test_simplify_conflict_sides() {
// Even though the tree-level conflict is a 4-sided conflict, each file is
// 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#"
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 })]))
[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"
fileA 2-sided conflict
fileB 2-sided conflict
@ -846,7 +846,7 @@ fn test_simplify_conflict_sides() {
2_edited
>>>>>>> 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"
fileA 2-sided conflict
fileB 2-sided conflict
@ -876,7 +876,7 @@ fn test_edit_delete_conflict_input_files() {
[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"
file 2-sided conflict including 1 deletion
[EOF]
@ -922,7 +922,7 @@ fn test_file_vs_dir() {
[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"
file 2-sided conflict including a directory
[EOF]
@ -978,13 +978,13 @@ fn test_description_with_dir_and_deletion() {
[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"
file 3-sided conflict including 1 deletion and a directory
[EOF]
");
// 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"
file 3-sided conflict including 1 deletion and a directory
[EOF]
@ -1038,7 +1038,7 @@ fn test_resolve_conflicts_with_executable() {
);
test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "x", "file2"]);
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"
file1 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.
[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"
diff --git a/file1 b/file1
index 0000000000..95cc18629d 100755
@ -1109,7 +1109,7 @@ fn test_resolve_conflicts_with_executable() {
[EOF]
");
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r"
file2 2-sided conflict including an executable
[EOF]
@ -1138,7 +1138,7 @@ fn test_resolve_conflicts_with_executable() {
Then run `jj squash` to move the resolution into the conflicted commit.
[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"
diff --git a/file2 b/file2
index 0000000000..775f078581 100755
@ -1156,7 +1156,7 @@ fn test_resolve_conflicts_with_executable() {
[EOF]
");
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r"
file1 2-sided conflict including an executable
[EOF]
@ -1196,7 +1196,7 @@ fn test_resolve_long_conflict_markers() {
&[("file", ">>>>>>> b\n")],
);
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"
file 2-sided conflict
[EOF]
@ -1255,7 +1255,7 @@ fn test_resolve_long_conflict_markers() {
Then run `jj squash` to move the resolution into the conflicted commit.
[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"
diff --git a/file b/file
--- a/file
@ -1280,7 +1280,7 @@ fn test_resolve_long_conflict_markers() {
[EOF]
");
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r"
file 2-sided conflict
[EOF]
@ -1342,7 +1342,7 @@ fn test_resolve_long_conflict_markers() {
>>>>>>> b
>>>>>>>>>>> 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"
diff --git a/file b/file
--- a/file
@ -1362,7 +1362,7 @@ fn test_resolve_long_conflict_markers() {
[EOF]
");
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r"
file 2-sided conflict
[EOF]
@ -1413,7 +1413,7 @@ fn test_resolve_long_conflict_markers() {
Then run `jj squash` to move the resolution into the conflicted commit.
[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"
diff --git a/file b/file
--- a/file
@ -1433,7 +1433,7 @@ fn test_resolve_long_conflict_markers() {
[EOF]
");
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r"
file 2-sided conflict
[EOF]
@ -1520,14 +1520,14 @@ fn test_multiple_conflicts() {
second b
>>>>>>> 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"
another_file 2-sided conflict
this_file_has_a_very_long_name_to_test_padding 2-sided conflict
[EOF]
");
// 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"
another_file 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.
[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"
diff --git a/another_file b/another_file
index 0000000000..a9fcc7d486 100644
@ -1574,7 +1574,7 @@ fn test_multiple_conflicts() {
+resolution another_file
[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"
this_file_has_a_very_long_name_to_test_padding 2-sided conflict
[EOF]
@ -1589,7 +1589,7 @@ fn test_multiple_conflicts() {
// Without a path, `jj resolve` should call the merge tool multiple times
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(
&editor_script,
@ -1604,7 +1604,7 @@ fn test_multiple_conflicts() {
)
.unwrap();
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"
diff --git a/another_file b/another_file
index 0000000000..7903e1c1c7 100644
@ -1682,7 +1682,7 @@ fn test_multiple_conflicts_with_error() {
&[("file1", "b1\n"), ("file2", "b2\n")],
);
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"
file1 2-sided conflict
file2 2-sided conflict
@ -1743,7 +1743,7 @@ fn test_multiple_conflicts_with_error() {
[EOF]
[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"
diff --git a/file1 b/file1
index 0000000000..95cc18629d 100644
@ -1761,7 +1761,7 @@ fn test_multiple_conflicts_with_error() {
[EOF]
");
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r"
file2 2-sided conflict
[EOF]
@ -1798,7 +1798,7 @@ fn test_multiple_conflicts_with_error() {
[EOF]
[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"
diff --git a/file1 b/file1
index 0000000000..95cc18629d 100644
@ -1816,7 +1816,7 @@ fn test_multiple_conflicts_with_error() {
[EOF]
");
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r"
file2 2-sided conflict
[EOF]
@ -1835,9 +1835,9 @@ fn test_multiple_conflicts_with_error() {
[EOF]
[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!(
test_env.jj_cmd_success(&repo_path, &["resolve", "--list"]),
test_env.run_jj_in(&repo_path, ["resolve", "--list"]),
@r"
file1 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
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @"");
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @"");
// Can restore another revision from its parents
test_env.jj_cmd_ok(&repo_path, &["undo"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r=@-"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r=@-"]);
insta::assert_snapshot!(output, @r"
A file2
[EOF]
");
@ -81,8 +81,8 @@ fn test_restore() {
Then run `jj squash` to move the resolution into the conflicted commit.
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r=@-"]);
insta::assert_snapshot!(stdout, @"");
let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r=@-"]);
insta::assert_snapshot!(output, @"");
// Can restore this revision from another revision
test_env.jj_cmd_ok(&repo_path, &["undo"]);
@ -95,8 +95,8 @@ fn test_restore() {
Added 1 files, modified 0 files, removed 2 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file2
[EOF]
");
@ -112,10 +112,10 @@ fn test_restore() {
Parent commit : rlvkpnrz ad805965 (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @"");
let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
D file1
A file2
A file3
@ -134,10 +134,10 @@ fn test_restore() {
Parent commit : rlvkpnrz f256040a (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @"");
let output = test_env.run_jj_in(&repo_path, ["diff", "-s", "-r", "@-"]);
insta::assert_snapshot!(output, @r"
D file1
A file2
A file3
@ -155,8 +155,8 @@ fn test_restore() {
Added 0 files, modified 1 files, removed 1 files
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["diff", "-s"]);
insta::assert_snapshot!(output, @r"
D file1
[EOF]
");
@ -198,7 +198,7 @@ fn test_restore_conflicted_merge() {
// Overwrite the file...
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"
Resolved conflict in file:
1 : <<<<<<< Conflict 1 of 1
@ -236,12 +236,12 @@ fn test_restore_conflicted_merge() {
b
>>>>>>> Conflict 1 of 1 ends
"###);
let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]);
insta::assert_snapshot!(stdout, @"");
let output = test_env.run_jj_in(&repo_path, ["diff"]);
insta::assert_snapshot!(output, @"");
// The same, but without the `file` argument. Overwrite the file...
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"
Resolved conflict in file:
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.
// "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
index 7898192261..81bf396956 100644
--- a/file
@ -354,7 +354,7 @@ fn test_restore_restore_descendants() {
+b
[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
index df967b96a5..81bf396956 100644
--- a/file
@ -386,8 +386,8 @@ fn test_restore_interactive() {
&["a"],
&[("file1", "b1\n"), ("file2", "b2\n"), ("file3", "b3\n")],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:11 b c0745ce2
b
M file1
@ -430,8 +430,8 @@ fn test_restore_interactive() {
shows the contents you want for the destination commit.
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:13 b bccde490
b
M file2
@ -454,8 +454,8 @@ fn test_restore_interactive() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:16 b 5921de19
b
M file2
@ -483,8 +483,8 @@ fn test_restore_interactive_merge() {
&["a", "b"],
&[("file1", "c1\n"), ("file2", "c2\n"), ("file3", "c3\n")],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(output, @r"
@ royxmykx test.user@example.com 2001-02-03 08:05:13 c 34042291
c
M file1
@ -531,8 +531,8 @@ fn test_restore_interactive_merge() {
shows the contents you want for the destination commit.
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(output, @r"
@ royxmykx test.user@example.com 2001-02-03 08:05:15 c 72e0cbf4
c
M file2
@ -567,8 +567,8 @@ fn test_restore_interactive_with_paths() {
&["a"],
&[("file1", "b1\n"), ("file2", "b2\n"), ("file3", "b3\n")],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:11 b c0745ce2
b
M file1
@ -601,8 +601,8 @@ fn test_restore_interactive_with_paths() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--summary"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "--summary"]);
insta::assert_snapshot!(output, @r"
@ zsuskuln test.user@example.com 2001-02-03 08:05:13 b 7187da33
b
M file2

View File

@ -501,14 +501,14 @@ fn test_alias() {
"###,
);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "my-root"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "my-root"]);
insta::assert_snapshot!(output, @r"
zzzzzzzz root() 00000000
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "identity(my-root)"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "identity(my-root)"]);
insta::assert_snapshot!(output, @r"
zzzzzzzz root() 00000000
[EOF]
");
@ -739,8 +739,8 @@ fn test_all_modifier() {
");
// Command that accepts multiple revisions by default
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-rall:all()"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-rall:all()"]);
insta::assert_snapshot!(output, @r"
@ qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059
(empty) (no description set)
zzzzzzzz root() 00000000
@ -765,8 +765,8 @@ fn test_all_modifier() {
");
// Template expression that accepts multiple revisions by default
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-Tself.contained_in('all:all()')"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-Tself.contained_in('all:all()')"]);
insta::assert_snapshot!(output, @r"
@ true
true
[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("file3"), "foo\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["show"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show"]);
insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -65,8 +65,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--context=0"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "--context=0"]);
insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -82,8 +82,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--color=debug"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "--color=debug"]);
insta::assert_snapshot!(output, @r"
Commit ID: <<commit_id::e34f04317a81edc6ba41fef239c0d0180f10656f>>
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>>)
@ -99,8 +99,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-s"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "-s"]);
insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -113,8 +113,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--types"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "--types"]);
insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -127,8 +127,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "--git"]);
insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -151,8 +151,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--git", "--context=0"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "--git", "--context=0"]);
insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -174,8 +174,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--git", "--color=debug"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "--git", "--color=debug"]);
insta::assert_snapshot!(output, @r"
Commit ID: <<commit_id::e34f04317a81edc6ba41fef239c0d0180f10656f>>
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>>)
@ -198,8 +198,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-s", "--git"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "-s", "--git"]);
insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author : Test User <test.user@example.com> (2001-02-03 08:05:09)
@ -224,8 +224,8 @@ fn test_show_basic() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "--stat"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["show", "--stat"]);
insta::assert_snapshot!(output, @r"
Commit ID: e34f04317a81edc6ba41fef239c0d0180f10656f
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
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");
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
[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, "b", &["a"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ b
a
@ -90,8 +90,8 @@ fn test_simplify_parents_no_change() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ b
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, "c", &["a"]);
create_commit(&test_env, &repo_path, "d", &["b", "c"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ d
c
@ -127,8 +127,8 @@ fn test_simplify_parents_no_change_diamond() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ d
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, "b", &["a"]);
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::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ c
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::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ c
b
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, "e", &["d"]);
create_commit(&test_env, &repo_path, "f", &["d", "e"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ f
e
@ -224,8 +224,8 @@ fn test_simplify_parents_multiple_redundant_parents() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ f
e
d
@ -248,8 +248,8 @@ fn test_simplify_parents_multiple_redundant_parents() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ f
e
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, "e", &["d"]);
create_commit(&test_env, &repo_path, "f", &["d", "e"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ f
e
@ -298,8 +298,8 @@ fn test_simplify_parents_no_args() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ f
e
d
@ -322,8 +322,8 @@ fn test_simplify_parents_no_args() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-r", "all()", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ f
e
d

View File

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

View File

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

View File

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

View File

@ -64,8 +64,8 @@ fn test_status_copies() {
std::fs::remove_file(repo_path.join("rename-source")).unwrap();
std::fs::write(repo_path.join("rename-target"), "rename").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output, @r"
Working copy changes:
M copy-source
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
// to the auto-merged parents)
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output, @r"
The working copy has no changes.
Working copy : mzvwutvl a538c72d (empty) (no description set)
Parent commit: rlvkpnrz d3dd19f1 left | (empty) left
@ -117,8 +117,8 @@ fn test_status_ignored_gitignore() {
.unwrap();
std::fs::write(repo_path.join(".gitignore"), "untracked/\n!dummy\n").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output, @r"
Working copy changes:
A .gitignore
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();
// 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"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["status", "file_1"]);
insta::assert_snapshot!(output, @r"
Working copy changes:
A file_1
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-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
(empty) boom-cont-2
× 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]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output, @r"
The working copy has no changes.
Working copy : yqosqzyt dcb25635 (conflict) (empty) boom-cont-2
Parent commit: royxmykx 664a4c6c (conflict) (empty) boom-cont
@ -221,8 +221,8 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&repo_path, &["status", "--color=always"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["status", "--color=always"]);
insta::assert_snapshot!(output, @r"
The working copy has no changes.
Working copy : yqosqzyt dcb25635 (conflict) (empty) boom-cont-2
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();
// 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
fixed 2
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]
");
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:
M conflicted.txt
Working copy : kmkuslsw caa7e9d5 fixed 2
@ -281,9 +281,9 @@ fn test_status_display_relevant_working_commit_conflict_hints() {
// Step back one.
// wc is still conflict free, parent has a conflict.
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
fixed 2
@ 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]
");
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:
M conflicted.txt
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
// our hinting logic doesn't get confused.
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
fixed 2
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]
");
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:
A conflicted.txt
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"
The working copy has no changes.
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("initially-untracked"), "...").unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
Untracked paths:
? always-untracked-file
? initially-untracked-file
@ -438,8 +438,8 @@ fn test_status_untracked_files() {
],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
Working copy changes:
A initially-untracked-file
A sub/initially-untracked
@ -453,8 +453,8 @@ fn test_status_untracked_files() {
test_env.jj_cmd_ok(&repo_path, &["new"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
Untracked paths:
? always-untracked-file
? sub/always-untracked
@ -472,8 +472,8 @@ fn test_status_untracked_files() {
"sub/initially-untracked",
],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
Working copy changes:
D initially-untracked-file
D sub/initially-untracked
@ -489,8 +489,8 @@ fn test_status_untracked_files() {
test_env.jj_cmd_ok(&repo_path, &["new"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["status"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&repo_path, ["status"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
Untracked paths:
? always-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
insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["tag", "list"]),
test_env.run_jj_in(&repo_path, ["tag", "list"]),
@r"
conflicted_tag (conflicted):
- rlvkpnrz caf975d0 (empty) commit1
@ -69,7 +69,7 @@ fn test_tag_list() {
");
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"
conflicted_tag (conflicted):
- rlvkpnrz caf975d0 (empty) commit1
@ -82,14 +82,14 @@ fn test_tag_list() {
// Test pattern matching.
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"
test_tag2: zsuskuln 3db783e0 (empty) commit2
[EOF]
");
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"
test_tag2: zsuskuln 3db783e0 (empty) commit2
[EOF]
@ -106,7 +106,7 @@ fn test_tag_list() {
)
"#;
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"
[conflicted_tag]
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
// purely by name, 'f(a)' would come first.
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&repo_path,
&[
[
"log",
"--no-graph",
"-r@",
@ -499,7 +499,7 @@ fn test_templater_alias_override() {
r#"--config=template-aliases.'f(a)'='"arg"'"#,
],
);
insta::assert_snapshot!(stdout, @"arg[EOF]");
insta::assert_snapshot!(output, @"arg[EOF]");
}
#[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 op_id_hex = output.stdout.raw()[3..15].to_string();
test_env.jj_cmd_ok(&repo_path, &["new", "-m", "child"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ child
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
// of the initial commit
let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["log", "-T", "description"]);
insta::assert_snapshot!(output, @r"
@ child
initial

View File

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

View File

@ -19,10 +19,10 @@ use crate::common::TestEnvironment;
#[test]
fn test_util_config_schema() {
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.
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",
"$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();
// 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
--- a/file
+++ b/file
@ -424,8 +424,8 @@ fn test_conflict_marker_length_stored_in_working_copy() {
.unwrap();
// The file should still be conflicted, and the new content should be saved
let stdout = test_env.jj_cmd_success(&repo_path, &["st"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["st"]);
insta::assert_snapshot!(output, @r"
Working copy changes:
M file
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
[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
--- a/file
+++ b/file
@ -479,8 +479,8 @@ fn test_conflict_marker_length_stored_in_working_copy() {
)
.unwrap();
let stdout = test_env.jj_cmd_success(&repo_path, &["st"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["st"]);
insta::assert_snapshot!(output, @r"
Working copy changes:
M file
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();
test_env.jj_cmd_ok(&main_path, &["commit", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz 8183d0fc (empty) (no description set)
[EOF]
");
@ -69,8 +69,8 @@ fn test_workspaces_add_second_workspace() {
");
// Both workspaces show up when we list them
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz 8183d0fc (empty) (no description set)
second: rzvqmyuk 5ed2222c (empty) (no description set)
[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, &["workspace", "add", "../ws2"]);
let stdout = test_env.jj_cmd_success(&ws2_path, &["sparse", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&ws2_path, ["sparse", "list"]);
insta::assert_snapshot!(output, @r"
foo
[EOF]
");
test_env.jj_cmd_ok(&ws2_path, &["sparse", "set", "--add=bar"]);
test_env.jj_cmd_ok(&ws2_path, &["workspace", "add", "../ws3"]);
let stdout = test_env.jj_cmd_success(&ws3_path, &["sparse", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&ws3_path, ["sparse", "list"]);
insta::assert_snapshot!(output, @r"
bar
foo
[EOF]
@ -109,8 +109,8 @@ fn test_workspaces_sparse_patterns() {
&ws3_path,
&["workspace", "add", "--sparse-patterns=copy", "../ws4"],
);
let stdout = test_env.jj_cmd_success(&ws4_path, &["sparse", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&ws4_path, ["sparse", "list"]);
insta::assert_snapshot!(output, @r"
bar
foo
[EOF]
@ -119,8 +119,8 @@ fn test_workspaces_sparse_patterns() {
&ws3_path,
&["workspace", "add", "--sparse-patterns=full", "../ws5"],
);
let stdout = test_env.jj_cmd_success(&ws5_path, &["sparse", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&ws5_path, ["sparse", "list"]);
insta::assert_snapshot!(output, @r"
.
[EOF]
");
@ -128,8 +128,8 @@ fn test_workspaces_sparse_patterns() {
&ws3_path,
&["workspace", "add", "--sparse-patterns=empty", "../ws6"],
);
let stdout = test_env.jj_cmd_success(&ws6_path, &["sparse", "list"]);
insta::assert_snapshot!(stdout, @"");
let output = test_env.run_jj_in(&ws6_path, ["sparse", "list"]);
insta::assert_snapshot!(output, @"");
}
/// 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", "all:@-+", "-m=merge"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: zsuskuln 35e47bff (empty) merge
[EOF]
");
@ -245,8 +245,8 @@ fn test_workspaces_add_at_operation() {
[EOF]
");
let stdout = test_env.jj_cmd_success(&secondary_path, &["op", "log", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&secondary_path, ["op", "log", "-Tdescription"]);
insta::assert_snapshot!(output, @r"
@ snapshot working copy
reconcile divergent operations
@ -277,8 +277,8 @@ fn test_workspaces_add_workspace_at_revision() {
std::fs::write(main_path.join("file-2"), "contents").unwrap();
test_env.jj_cmd_ok(&main_path, &["commit", "-m", "second"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: kkmpptxz dadeedb4 (empty) (no description set)
[EOF]
");
@ -406,8 +406,8 @@ fn test_workspaces_add_workspace_from_subdir() {
std::fs::write(subdir_path.join("file"), "contents").unwrap();
test_env.jj_cmd_ok(&main_path, &["commit", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz e1038e77 (empty) (no description set)
[EOF]
");
@ -425,8 +425,8 @@ fn test_workspaces_add_workspace_from_subdir() {
"#);
// Both workspaces show up when we list them
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&secondary_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz e1038e77 (empty) (no description set)
secondary: rzvqmyuk 7ad84461 (empty) (no description set)
[EOF]
@ -455,8 +455,8 @@ fn test_workspaces_add_workspace_in_current_workspace() {
"#);
// Workspace created despite warning
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz 46d9ba8b (no description set)
secondary: pmmvwywv 0a77a39d (empty) (no description set)
[EOF]
@ -474,8 +474,8 @@ fn test_workspaces_add_workspace_in_current_workspace() {
"#);
// Both workspaces created
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz 477c647f (no description set)
secondary: pmmvwywv 0a77a39d (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
// child directories and will therefore be snapshotted
let stdout = test_env.jj_cmd_success(&main_path, &["file", "list"]);
insta::assert_snapshot!(stdout.normalize_backslash(), @r"
let output = test_env.run_jj_in(&main_path, ["file", "list"]);
insta::assert_snapshot!(output.normalize_backslash(), @r"
file
secondary/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.
test_env.jj_cmd_ok(&main_path, &["abandon", "@-"]);
let stdout = test_env.jj_cmd_success(
let output = test_env.run_jj_in(
&main_path,
&[
[
"operation",
"log",
"--template",
@ -792,7 +792,7 @@ fn test_workspaces_current_op_discarded_by_other(automatic: bool) {
],
);
insta::allow_duplicates! {
insta::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
@ 757bc1140b abandon commit 20dd439c4bd12c6ad56c187ac490bd0141804618f638dc5c4dc92ff9aecba20f152b23160db9dcf61beb31a5cb14091d9def5a36d11c9599cc4d2e5689236af1
8d4abed655 create initial working-copy commit in 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
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::assert_snapshot!(stdout, @r"
insta::assert_snapshot!(output, @r"
added
deleted
modified
@ -945,8 +945,8 @@ fn test_workspaces_update_stale_noop() {
[exit status: 1]
");
let stdout = test_env.jj_cmd_success(&main_path, &["op", "log", "-Tdescription"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["op", "log", "-Tdescription"]);
insta::assert_snapshot!(output, @r"
@ add workspace 'default'
[EOF]
@ -1006,8 +1006,8 @@ fn test_workspaces_forget() {
insta::assert_snapshot!(stderr, @"");
// When listing workspaces, only the secondary workspace shows up
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
secondary: pmmvwywv 18463f43 (empty) (no description set)
[EOF]
");
@ -1058,8 +1058,8 @@ fn test_workspaces_forget() {
insta::assert_snapshot!(stdout, @"");
insta::assert_snapshot!(stderr, @"");
// No workspaces left
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @"");
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @"");
}
#[test]
@ -1075,8 +1075,8 @@ fn test_workspaces_forget_multi_transaction() {
test_env.jj_cmd_ok(&main_path, &["workspace", "add", "../third"]);
// there should be three workspaces
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz 909d51b1 (empty) (no description set)
second: pmmvwywv 18463f43 (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
test_env.jj_cmd_ok(&main_path, &["workspace", "forget", "second", "third"]);
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz 909d51b1 (empty) (no description set)
[EOF]
");
// 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"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["op", "log", "--limit", "1"]);
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
forget workspaces 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"]);
// finally, there should be three workspaces at the end
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: rlvkpnrz 909d51b1 (empty) (no description set)
second: pmmvwywv 18463f43 (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@"]);
// 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"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: qpvuntsm 4e8f9d2b (no description set)
fourth: 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
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: 8183d0fcaa4c (current)
second: 0a77a39d7d6f
[EOF]
");
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&secondary_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: 8183d0fcaa4c
second: 0a77a39d7d6f (current)
[EOF]
@ -1222,15 +1222,15 @@ fn test_workspaces_root() {
let main_path = test_env.env_root().join("main");
let secondary_path = test_env.env_root().join("secondary");
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "root"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "root"]);
insta::assert_snapshot!(output, @r"
$TEST_ENV/main
[EOF]
");
let main_subdir_path = main_path.join("subdir");
std::fs::create_dir(&main_subdir_path).unwrap();
let stdout = test_env.jj_cmd_success(&main_subdir_path, &["workspace", "root"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_subdir_path, ["workspace", "root"]);
insta::assert_snapshot!(output, @r"
$TEST_ENV/main
[EOF]
");
@ -1239,15 +1239,15 @@ fn test_workspaces_root() {
&main_path,
&["workspace", "add", "--name", "secondary", "../secondary"],
);
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "root"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&secondary_path, ["workspace", "root"]);
insta::assert_snapshot!(output, @r"
$TEST_ENV/secondary
[EOF]
");
let secondary_subdir_path = secondary_path.join("subdir");
std::fs::create_dir(&secondary_subdir_path).unwrap();
let stdout = test_env.jj_cmd_success(&secondary_subdir_path, &["workspace", "root"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&secondary_subdir_path, ["workspace", "root"]);
insta::assert_snapshot!(output, @r"
$TEST_ENV/secondary
[EOF]
");
@ -1261,8 +1261,8 @@ fn test_debug_snapshot() {
std::fs::write(repo_path.join("file"), "contents").unwrap();
test_env.jj_cmd_ok(&repo_path, &["debug", "snapshot"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
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
snapshot working copy
args: jj debug snapshot
@ -1272,8 +1272,8 @@ fn test_debug_snapshot() {
[EOF]
");
test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&repo_path, ["op", "log"]);
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
describe commit 4e8f9d2be039994f589b4e57ac5e9488703e604d
args: jj describe -m initial
@ -1351,18 +1351,18 @@ fn test_workspaces_rename_workspace() {
let secondary_path = test_env.env_root().join("secondary");
// Both workspaces show up when we list them
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: qpvuntsm 230dd059 (empty) (no description set)
second: uuqppmxq 57d63245 (empty) (no description set)
[EOF]
");
let stdout = test_env.jj_cmd_success(&secondary_path, &["workspace", "rename", "third"]);
insta::assert_snapshot!(stdout, @"");
let output = test_env.run_jj_in(&secondary_path, ["workspace", "rename", "third"]);
insta::assert_snapshot!(output, @"");
let stdout = test_env.jj_cmd_success(&main_path, &["workspace", "list"]);
insta::assert_snapshot!(stdout, @r"
let output = test_env.run_jj_in(&main_path, ["workspace", "list"]);
insta::assert_snapshot!(output, @r"
default: qpvuntsm 230dd059 (empty) (no description set)
third: uuqppmxq 57d63245 (empty) (no description set)
[EOF]