mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-01 00:50:57 +00:00
cli: label log/obslog template as "log"
It was removed at 522025e091
"log: remove unused and inconsistent `log`
label", but obslog had the same inconsistency. Since it's now easy to label
the template output, let's re-add the "log" label.
The change in test_templater_upper_lower() is noop. Formatter no longer
emits reset sequence in the middle because the template is still labeled.
This commit is contained in:
parent
6da9167585
commit
1b3bcedd53
3 changed files with 15 additions and 12 deletions
|
@ -119,11 +119,13 @@ pub(crate) fn cmd_log(
|
|||
Some(value) => value.to_string(),
|
||||
None => command.settings().config().get_string("templates.log")?,
|
||||
};
|
||||
template = workspace_command.parse_template(
|
||||
&language,
|
||||
&template_string,
|
||||
CommitTemplateLanguage::wrap_commit,
|
||||
)?;
|
||||
template = workspace_command
|
||||
.parse_template(
|
||||
&language,
|
||||
&template_string,
|
||||
CommitTemplateLanguage::wrap_commit,
|
||||
)?
|
||||
.labeled("log");
|
||||
node_template = workspace_command
|
||||
.parse_template(
|
||||
&language,
|
||||
|
|
|
@ -79,11 +79,13 @@ pub(crate) fn cmd_obslog(
|
|||
Some(value) => value.to_string(),
|
||||
None => command.settings().config().get_string("templates.log")?,
|
||||
};
|
||||
template = workspace_command.parse_template(
|
||||
&language,
|
||||
&template_string,
|
||||
CommitTemplateLanguage::wrap_commit,
|
||||
)?;
|
||||
template = workspace_command
|
||||
.parse_template(
|
||||
&language,
|
||||
&template_string,
|
||||
CommitTemplateLanguage::wrap_commit,
|
||||
)?
|
||||
.labeled("log");
|
||||
node_template = workspace_command
|
||||
.parse_template(
|
||||
&language,
|
||||
|
@ -96,7 +98,6 @@ pub(crate) fn cmd_obslog(
|
|||
ui.request_pager();
|
||||
let mut formatter = ui.stdout_formatter();
|
||||
let formatter = formatter.as_mut();
|
||||
formatter.push_label("log")?;
|
||||
|
||||
let mut commits = topo_order_reverse(
|
||||
vec![start_commit],
|
||||
|
|
|
@ -124,7 +124,7 @@ fn test_templater_upper_lower() {
|
|||
|
||||
insta::assert_snapshot!(
|
||||
render(r#"change_id.shortest(4).upper() ++ change_id.shortest(4).upper().lower()"#),
|
||||
@"[1m[38;5;5mZ[0m[38;5;8mZZZ[39m[1m[38;5;5mz[0m[38;5;8mzzz[39m");
|
||||
@"[1m[38;5;5mZ[0m[38;5;8mZZZ[1m[38;5;5mz[0m[38;5;8mzzz[39m");
|
||||
insta::assert_snapshot!(
|
||||
render(r#""Hello".upper() ++ "Hello".lower()"#), @"HELLOhello");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue