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

templates: reimplement builtin_change_id_with_hidden_and_divergent_info alias

This helps extract commit_summary template as an alias function.
This commit is contained in:
Yuya Nishihara 2024-04-25 17:30:09 +09:00
parent 2f45a482a6
commit 2bd6983003
7 changed files with 17 additions and 17 deletions

View file

@ -11,9 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Breaking changes
* The default template alias `builtin_op_log_root(op_id: OperationId)` was replaced by `format_root_operation(root: Operation)`.
* The default template alias `builtin_log_root(change_id: ChangeId, commit_id: CommitId)` was replaced by `format_root_commit(root: Commit)`.
* The default template aliases were replaced as follows:
* `builtin_op_log_root(op_id: OperationId)` ->
`format_root_operation(root: Operation)`
* `builtin_log_root(change_id: ChangeId, commit_id: CommitId)` ->
`format_root_commit(root: Commit)`
* `builtin_change_id_with_hidden_and_divergent_info` ->
`format_short_change_id_with_hidden_and_divergent_info(commit: Commit)`
### New features

View file

@ -1,7 +1,7 @@
[templates]
commit_summary = '''
separate(" ",
builtin_change_id_with_hidden_and_divergent_info,
format_short_change_id_with_hidden_and_divergent_info(self),
format_short_commit_id(commit_id),
separate(commit_summary_separator,
branches,
@ -16,7 +16,7 @@ separate(" ",
commit_summary_no_branches = '''
separate(" ",
builtin_change_id_with_hidden_and_divergent_info,
format_short_change_id_with_hidden_and_divergent_info(self),
format_short_commit_id(commit_id),
if(conflict, label("conflict", "(conflict)")),
if(empty, label("empty", "(empty)")),
@ -46,7 +46,7 @@ if(root,
label(if(current_working_copy, "working_copy"),
concat(
separate(" ",
builtin_change_id_with_hidden_and_divergent_info,
format_short_change_id_with_hidden_and_divergent_info(self),
if(author.email(), author.username(), email_placeholder),
format_timestamp(committer.timestamp()),
branches,
@ -68,7 +68,7 @@ if(root,
label(if(current_working_copy, "working_copy"),
concat(
separate(" ",
builtin_change_id_with_hidden_and_divergent_info,
format_short_change_id_with_hidden_and_divergent_info(self),
format_short_signature(author),
format_timestamp(committer.timestamp()),
branches,
@ -155,13 +155,13 @@ separate(" ",
# 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 = '''
if(hidden,
'format_short_change_id_with_hidden_and_divergent_info(commit)' = '''
if(commit.hidden(),
label("hidden",
format_short_change_id(change_id) ++ " hidden"
format_short_change_id(commit.change_id()) ++ " hidden"
),
label(if(divergent, "divergent"),
format_short_change_id(change_id) ++ if(divergent, "??")
label(if(commit.divergent(), "divergent"),
format_short_change_id(commit.change_id()) ++ if(commit.divergent(), "??")
)
)
'''

View file

@ -40,7 +40,6 @@ fn test_log_with_no_template() {
For more information, try '--help'.
Hint: The following template aliases are defined:
- builtin_change_id_with_hidden_and_divergent_info
- builtin_log_comfortable
- builtin_log_compact
- builtin_log_detailed

View file

@ -275,7 +275,6 @@ fn test_obslog_with_no_template() {
For more information, try '--help'.
Hint: The following template aliases are defined:
- builtin_change_id_with_hidden_and_divergent_info
- builtin_log_comfortable
- builtin_log_compact
- builtin_log_detailed

View file

@ -136,7 +136,6 @@ fn test_op_log_with_no_template() {
For more information, try '--help'.
Hint: The following template aliases are defined:
- builtin_change_id_with_hidden_and_divergent_info
- builtin_log_comfortable
- builtin_log_compact
- builtin_log_detailed

View file

@ -60,7 +60,6 @@ fn test_show_with_no_template() {
For more information, try '--help'.
Hint: The following template aliases are defined:
- builtin_change_id_with_hidden_and_divergent_info
- builtin_log_comfortable
- builtin_log_compact
- builtin_log_detailed

View file

@ -111,7 +111,7 @@ fn test_templater_parse_error() {
| ^-----^
|
= Keyword "builtin" doesn't exist
Hint: Did you mean "builtin_change_id_with_hidden_and_divergent_info", "builtin_log_comfortable", "builtin_log_compact", "builtin_log_detailed", "builtin_log_node", "builtin_log_node_ascii", "builtin_log_oneline", "builtin_op_log_comfortable", "builtin_op_log_compact", "builtin_op_log_node", "builtin_op_log_node_ascii"?
Hint: Did you mean "builtin_log_comfortable", "builtin_log_compact", "builtin_log_detailed", "builtin_log_node", "builtin_log_node_ascii", "builtin_log_oneline", "builtin_op_log_comfortable", "builtin_op_log_compact", "builtin_op_log_node", "builtin_op_log_node_ascii"?
"###);
}