ok/jj
1
0
Fork 0
forked from mirrors/jj

cli change id templates: make "hidden" override "divergent"

See the test changes in `test_undo.rs` for motivation. This matters rarely, but
seems to be better.
This commit is contained in:
Ilya Grigoriev 2023-10-25 21:18:58 -07:00
parent 1733ae22c7
commit eeb93cc8be
4 changed files with 17 additions and 14 deletions

View file

@ -15,9 +15,6 @@
"divergent rest" = "red"
"divergent prefix" = {fg = "red", underline=true}
"hidden prefix" = "default"
"divergent hidden" = {fg = "default", bold = true}
"divergent hidden prefix" = {fg = "default", underline = false}
"divergent hidden rest" = {fg ="bright black", bold = false}
"email" = "yellow"
"username" = "yellow"

View file

@ -133,10 +133,16 @@ commit_summary_separator = 'label("separator", " | ")'
time_range.start().ago() ++ label("time", ", lasted ") ++ time_range.duration()'''
'format_timestamp(timestamp)' = 'timestamp'
# We have "hidden" override "divergent", since a hidden revision does not cause
# change id conflicts and is not affected by such conflicts; you have to use the
# commit id to refer to a hidden revision regardless.
builtin_change_id_with_hidden_and_divergent_info = '''
label(
separate(" ", if(divergent, "divergent"), if(hidden, "hidden")),
separate(" ",
format_short_change_id(change_id) ++ if(divergent, "??"),
if(hidden, "hidden")))
if(hidden,
label("hidden",
format_short_change_id(change_id) ++ " hidden"
),
label(if(divergent, "divergent"),
format_short_change_id(change_id) ++ if(divergent,"??")
)
)
'''

View file

@ -344,9 +344,9 @@ fn test_log_obslog_divergence() {
insta::assert_snapshot!(stdout, @r###"
@ qpvuntsm?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e
description 1
qpvuntsm?? hidden test.user@example.com 2001-02-03 04:05:08.000 +07:00 3b68ce25
qpvuntsm hidden test.user@example.com 2001-02-03 04:05:08.000 +07:00 3b68ce25
(no description set)
qpvuntsm?? hidden test.user@example.com 2001-02-03 04:05:07.000 +07:00 230dd059
qpvuntsm hidden test.user@example.com 2001-02-03 04:05:07.000 +07:00 230dd059
(empty) (no description set)
"###);
@ -355,9 +355,9 @@ fn test_log_obslog_divergence() {
insta::assert_snapshot!(stdout, @r###"
@ qpvuntsm?? test.user@example.com 2001-02-03 04:05:08.000 +07:00 7a17d52e
description 1
qpvuntsm?? hidden test.user@example.com 2001-02-03 04:05:08.000 +07:00 3b68ce25
qpvuntsm hidden test.user@example.com 2001-02-03 04:05:08.000 +07:00 3b68ce25
(no description set)
qpvuntsm?? hidden test.user@example.com 2001-02-03 04:05:07.000 +07:00 230dd059
qpvuntsm hidden test.user@example.com 2001-02-03 04:05:07.000 +07:00 230dd059
(empty) (no description set)
"###);
}

View file

@ -112,7 +112,7 @@ fn test_git_push_undo() {
// git fetch && jj undo && jj git fetch` would become a no-op.
insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###"
main (conflicted):
- qpvuntsm?? hidden 0cffb614 (empty) AA
- qpvuntsm hidden 0cffb614 (empty) AA
+ qpvuntsm?? 0a3e99f0 (empty) CC
+ qpvuntsm?? 8c05de15 (empty) BB
@origin (behind by 1 commits): qpvuntsm?? 8c05de15 (empty) BB
@ -270,7 +270,7 @@ fn test_git_push_undo_colocated() {
// same result in a seemingly different way?
insta::assert_snapshot!(get_branch_output(&test_env, &repo_path), @r###"
main (conflicted):
- qpvuntsm?? hidden 0cffb614 (empty) AA
- qpvuntsm hidden 0cffb614 (empty) AA
+ qpvuntsm?? 0a3e99f0 (empty) CC
+ qpvuntsm?? 8c05de15 (empty) BB
@git (behind by 1 commits): qpvuntsm?? 0a3e99f0 (empty) CC