-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: don't use format_*() in annotate template, truncate author, omit…
… commit id The problem is that author names are variable-length by nature, and format_*() can be customized in that way. Commit ids are redundant in most cases where commits aren't diverged. We could add some format_short_fixed_length_*() hook points, but it would probably be easier to just customize the annotation template at all.
- Loading branch information
Showing
2 changed files
with
29 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,16 +32,19 @@ fn test_annotate_linear() { | |
let repo_path = test_env.env_root().join("repo"); | ||
|
||
std::fs::write(repo_path.join("file.txt"), "line1\n").unwrap(); | ||
test_env.jj_cmd_ok(&repo_path, &["describe", "-m=initial"]); | ||
test_env.jj_cmd_ok( | ||
&repo_path, | ||
&["describe", "-m=initial", "--author=Foo <[email protected]>"], | ||
); | ||
|
||
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###" | ||
qpvuntsm 8934c772 [email protected] 2001-02-03 08:05:08 1: line1 | ||
kkmpptxz 41ae16e6 test.[email protected] 2001-02-03 08:05:10 2: new text from new commit | ||
"###); | ||
insta::assert_snapshot!(stdout, @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 | ||
"); | ||
} | ||
|
||
#[test] | ||
|
@@ -72,11 +75,11 @@ fn test_annotate_merge() { | |
.unwrap(); | ||
|
||
let stdout = test_env.jj_cmd_success(&repo_path, &["file", "annotate", "file.txt"]); | ||
insta::assert_snapshot!(stdout, @r###" | ||
qpvuntsm 8934c772 test.[email protected] 2001-02-03 08:05:08 1: line1 | ||
zsuskuln 712ba14a test.[email protected] 2001-02-03 08:05:11 2: new text from new commit 1 | ||
royxmykx b0571bd9 test.[email protected] 2001-02-03 08:05:13 3: new text from new commit 2 | ||
"###); | ||
insta::assert_snapshot!(stdout, @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 | ||
"); | ||
} | ||
|
||
#[test] | ||
|
@@ -102,15 +105,15 @@ fn test_annotate_conflicted() { | |
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###" | ||
qpvuntsm 8934c772 test.[email protected] 2001-02-03 08:05:08 1: line1 | ||
yostqsxw 7b90c9f6 test.[email protected] 2001-02-03 08:05:15 2: <<<<<<< Conflict 1 of 1 | ||
yostqsxw 7b90c9f6 test.[email protected] 2001-02-03 08:05:15 3: %%%%%%% Changes from base to side #1 | ||
yostqsxw 7b90c9f6 test.[email protected] 2001-02-03 08:05:15 4: +new text from new commit 1 | ||
yostqsxw 7b90c9f6 test.[email protected] 2001-02-03 08:05:15 5: +++++++ Contents of side #2 | ||
royxmykx b0571bd9 test.[email protected] 2001-02-03 08:05:13 6: new text from new commit 2 | ||
yostqsxw 7b90c9f6 test.[email protected] 2001-02-03 08:05:15 7: >>>>>>> Conflict 1 of 1 ends | ||
"###); | ||
insta::assert_snapshot!(stdout, @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 | ||
yostqsxw test.use 2001-02-03 08:05:15 4: +new text from new commit 1 | ||
yostqsxw test.use 2001-02-03 08:05:15 5: +++++++ Contents of side #2 | ||
royxmykx test.use 2001-02-03 08:05:13 6: new text from new commit 2 | ||
yostqsxw test.use 2001-02-03 08:05:15 7: >>>>>>> Conflict 1 of 1 ends | ||
"); | ||
} | ||
|
||
#[test] | ||
|
@@ -141,8 +144,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###" | ||
qpvuntsm 8934c772 test.[email protected] 2001-02-03 08:05:08 1: line1 | ||
zsuskuln 712ba14a test.[email protected] 2001-02-03 08:05:11 2: new text from new commit 1 | ||
"###); | ||
insta::assert_snapshot!(stdout, @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 | ||
"); | ||
} |