Skip to content

Commit

Permalink
templates: align attributes in builtin_log_detailed
Browse files Browse the repository at this point in the history
Change-Id: Id00000003feb0508bf7f08e0a0275ba7f7695b70
  • Loading branch information
avamsi committed Dec 8, 2024
1 parent 6c72a3d commit 0794f87
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 68 deletions.
4 changes: 2 additions & 2 deletions cli/src/config/templates.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ concat(
"Commit ID: " ++ commit_id ++ "\n",
"Change ID: " ++ change_id ++ "\n",
surround("Bookmarks: ", "\n", separate(" ", local_bookmarks, remote_bookmarks)),
surround("Tags: ", "\n", tags),
"Author: " ++ format_detailed_signature(author) ++ "\n",
surround("Tags : ", "\n", tags),
"Author : " ++ format_detailed_signature(author) ++ "\n",
"Committer: " ++ format_detailed_signature(committer) ++ "\n",
"\n",
indent(" ",
Expand Down
18 changes: 9 additions & 9 deletions cli/tests/test_backout_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ fn test_backout_multiple() {
"###);
// View the output of each backed out commit
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "@+"]);
insta::assert_snapshot!(stdout, @r###"
insta::assert_snapshot!(stdout, @r#"
Commit ID: 8ff3fbc2ccb0d66985f558c461d1643cebb4c7d6
Change ID: wqnwkozpkustnxypnnntnykwrqrkrpvv
Author: Test User <[email protected]> (2001-02-03 08:05:19)
Author : Test User <[email protected]> (2001-02-03 08:05:19)
Committer: Test User <[email protected]> (2001-02-03 08:05:19)
Back out "e"
Expand All @@ -156,12 +156,12 @@ fn test_backout_multiple() {
1 1: a
2 2: b
3 : c
"###);
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "@++"]);
insta::assert_snapshot!(stdout, @r###"
insta::assert_snapshot!(stdout, @r#"
Commit ID: d31d42e0267f6524d445348b1dd00926c62a6b57
Change ID: mouksmquosnpvwqrpsvvxtxpywpnxlss
Author: Test User <[email protected]> (2001-02-03 08:05:19)
Author : Test User <[email protected]> (2001-02-03 08:05:19)
Committer: Test User <[email protected]> (2001-02-03 08:05:19)
Back out "c"
Expand All @@ -170,12 +170,12 @@ fn test_backout_multiple() {
Removed regular file b:
1 : b
"###);
"#);
let stdout = test_env.jj_cmd_success(&repo_path, &["show", "@+++"]);
insta::assert_snapshot!(stdout, @r###"
insta::assert_snapshot!(stdout, @r#"
Commit ID: 6504c4ded177fba2334f76683d1aa643700d5073
Change ID: tqvpomtpwrqsylrpsxknultrymmqxmxv
Author: Test User <[email protected]> (2001-02-03 08:05:19)
Author : Test User <[email protected]> (2001-02-03 08:05:19)
Committer: Test User <[email protected]> (2001-02-03 08:05:19)
Back out "b"
Expand All @@ -185,7 +185,7 @@ fn test_backout_multiple() {
Modified regular file a:
1 1: a
2 : b
"###);
"#);
}

fn get_log_output(test_env: &TestEnvironment, cwd: &Path) -> String {
Expand Down
31 changes: 15 additions & 16 deletions cli/tests/test_commit_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,31 +316,31 @@ fn test_log_builtin_templates() {
[EOF]
"###);

insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r###"
insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r#"
Commit ID: dc31539712c7294d1d712cec63cef4504b94ca74
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Bookmarks: my-bookmark
Author: (no name set) <(no email set)> (2001-02-03 08:05:08)
Author : (no name set) <(no email set)> (2001-02-03 08:05:08)
Committer: (no name set) <(no email set)> (2001-02-03 08:05:08)
(no description set)
Commit ID: 230dd059e1b059aefc0da06a2e5a7dbf22362f22
Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu
Author: Test User <[email protected]> (2001-02-03 08:05:07)
Author : Test User <[email protected]> (2001-02-03 08:05:07)
Committer: Test User <[email protected]> (2001-02-03 08:05:07)
(no description set)
Commit ID: 0000000000000000000000000000000000000000
Change ID: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Author: (no name set) <(no email set)> (1970-01-01 11:00:00)
Author : (no name set) <(no email set)> (1970-01-01 11:00:00)
Committer: (no name set) <(no email set)> (1970-01-01 11:00:00)
(no description set)
[EOF]
"###);
"#);
}

#[test]
Expand Down Expand Up @@ -386,30 +386,29 @@ fn test_log_builtin_templates_colored() {
"#);

insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r###"
insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r#"
@ Commit ID: dc31539712c7294d1d712cec63cef4504b94ca74
│ Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
│ Bookmarks: my-bookmark
│ Author: [38;5;1m(no name set)[39m <[38;5;1m(no email set)[39m> ([38;5;6m2001-02-03 08:05:08[39m)
│ Author : [38;5;1m(no name set)[39m <[38;5;1m(no email set)[39m> ([38;5;6m2001-02-03 08:05:08[39m)
│ Committer: (no name set) <(no email set)> (2001-02-03 08:05:08)
│  (no description set)
○ Commit ID: 230dd059e1b059aefc0da06a2e5a7dbf22362f22
│ Change ID: qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu
│ Author: [38;5;3mTest User[39m <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
│ Author : [38;5;3mTest User[39m <[38;5;[email protected][39m> ([38;5;6m2001-02-03 08:05:07[39m)
│ Committer: Test User <[38;5;[email protected]> (2001-02-03 08:05:07)
│  (no description set)
◆ Commit ID: 0000000000000000000000000000000000000000
Change ID: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Author: [38;5;1m(no name set)[39m <[38;5;1m(no email set)[39m> ([38;5;6m1970-01-01 11:00:00[39m)
Author : [38;5;1m(no name set)[39m <[38;5;1m(no email set)[39m> ([38;5;6m1970-01-01 11:00:00[39m)
Committer: (no name set) <(no email set)> (1970-01-01 11:00:00)
 (no description set)
"###);
"#);
}

#[test]
Expand Down Expand Up @@ -455,30 +454,30 @@ fn test_log_builtin_templates_colored_debug() {
<<log::>>
"#);

insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r###"
insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r#"
<<node working_copy::@>> <<log::Commit ID: >><<log commit_id::dc31539712c7294d1d712cec63cef4504b94ca74>><<log::>>
│ <<log::Change ID: >><<log change_id::rlvkpnrzqnoowoytxnquwvuryrwnrmlp>><<log::>>
│ <<log::Bookmarks: >><<log local_bookmarks name::my-bookmark>><<log::>>
│ <<log::Author: >>[38;5;1m<<log name placeholder::(no name set)>>[39m<<log:: <>>[38;5;1m<<log email placeholder::(no email set)>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::2001-02-03 08:05:08>>[39m<<log::)>>
│ <<log::Author : >>[38;5;1m<<log name placeholder::(no name set)>>[39m<<log:: <>>[38;5;1m<<log email placeholder::(no email set)>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::2001-02-03 08:05:08>>[39m<<log::)>>
│ <<log::Committer: >><<log name placeholder::(no name set)>><<log:: <>><<log email placeholder::(no email set)>><<log::> (>><<log committer timestamp local format::2001-02-03 08:05:08>><<log::)>>
│ <<log::>>
│ <<log empty description placeholder:: (no description set)>><<log::>>
│ <<log::>>
<<node::○>> <<log::Commit ID: >><<log commit_id::230dd059e1b059aefc0da06a2e5a7dbf22362f22>><<log::>>
│ <<log::Change ID: >><<log change_id::qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu>><<log::>>
│ <<log::Author: >>[38;5;3m<<log author name::Test User>>[39m<<log:: <>>[38;5;3m<<log author email::[email protected]>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::2001-02-03 08:05:07>>[39m<<log::)>>
│ <<log::Author : >>[38;5;3m<<log author name::Test User>>[39m<<log:: <>>[38;5;3m<<log author email::[email protected]>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::2001-02-03 08:05:07>>[39m<<log::)>>
│ <<log::Committer: >><<log committer name::Test User>><<log:: <>><<log committer email::[email protected]>><<log::> (>><<log committer timestamp local format::2001-02-03 08:05:07>><<log::)>>
│ <<log::>>
│ <<log empty description placeholder:: (no description set)>><<log::>>
│ <<log::>>
<<node immutable::◆>> <<log::Commit ID: >><<log commit_id::0000000000000000000000000000000000000000>><<log::>>
<<log::Change ID: >><<log change_id::zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz>><<log::>>
<<log::Author: >>[38;5;1m<<log name placeholder::(no name set)>>[39m<<log:: <>>[38;5;1m<<log email placeholder::(no email set)>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::1970-01-01 11:00:00>>[39m<<log::)>>
<<log::Author : >>[38;5;1m<<log name placeholder::(no name set)>>[39m<<log:: <>>[38;5;1m<<log email placeholder::(no email set)>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::1970-01-01 11:00:00>>[39m<<log::)>>
<<log::Committer: >><<log name placeholder::(no name set)>><<log:: <>><<log email placeholder::(no email set)>><<log::> (>><<log committer timestamp local format::1970-01-01 11:00:00>><<log::)>>
<<log::>>
<<log empty description placeholder:: (no description set)>><<log::>>
<<log::>>
"###);
"#);
}

#[test]
Expand Down
18 changes: 9 additions & 9 deletions cli/tests/test_diff_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2086,10 +2086,10 @@ fn test_diff_external_tool() {
"###);

insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["show", "--tool=fake-diff-editor"]), @r###"
test_env.jj_cmd_success(&repo_path, &["show", "--tool=fake-diff-editor"]), @r#"
Commit ID: 39d9055d70873099fd924b9af218289d5663eac8
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author: Test User <[email protected]> (2001-02-03 08:05:09)
Author : Test User <[email protected]> (2001-02-03 08:05:09)
Committer: Test User <[email protected]> (2001-02-03 08:05:09)
(no description set)
Expand All @@ -2099,7 +2099,7 @@ fn test_diff_external_tool() {
--
file2
file3
"###);
"#);

// Enabled by default, looks up the merge-tools table
let config = "--config-toml=ui.diff.tool='fake-diff-editor'";
Expand Down Expand Up @@ -2133,16 +2133,16 @@ fn test_diff_external_tool() {
// Non-zero exit code isn't an error
std::fs::write(&edit_script, "print diff\0fail").unwrap();
let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["show", "--tool=fake-diff-editor"]);
insta::assert_snapshot!(stdout, @r###"
insta::assert_snapshot!(stdout, @r#"
Commit ID: 39d9055d70873099fd924b9af218289d5663eac8
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author: Test User <[email protected]> (2001-02-03 08:05:09)
Author : Test User <[email protected]> (2001-02-03 08:05:09)
Committer: Test User <[email protected]> (2001-02-03 08:05:09)
(no description set)
diff
"###);
"#);
insta::assert_snapshot!(stderr.replace("exit code:", "exit status:"), @r###"
Warning: Tool exited with exit status: 1 (run with --debug to see the exact invocation)
"###);
Expand Down Expand Up @@ -2237,10 +2237,10 @@ fn test_diff_external_file_by_file_tool() {
"###);

insta::assert_snapshot!(
test_env.jj_cmd_success(&repo_path, &["show", config]), @r###"
test_env.jj_cmd_success(&repo_path, &["show", config]), @r#"
Commit ID: 7b01704a670bc77d11ed117d362855cff1d4513b
Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp
Author: Test User <[email protected]> (2001-02-03 08:05:09)
Author : Test User <[email protected]> (2001-02-03 08:05:09)
Committer: Test User <[email protected]> (2001-02-03 08:05:09)
(no description set)
Expand All @@ -2257,7 +2257,7 @@ fn test_diff_external_file_by_file_tool() {
file1
--
file4
"###);
"#);
}

#[cfg(unix)]
Expand Down
Loading

0 comments on commit 0794f87

Please sign in to comment.