mirror of
https://github.com/martinvonz/jj.git
synced 2025-05-31 03:42:39 +00:00
cli: add top-level command-name/context labels to graph "node" templates
It's inconsistent that the content templates have e.g. "op_log operation", but the graph node templates don't.
This commit is contained in:
parent
f8a0fcfc47
commit
d43d8c4e23
@ -119,7 +119,7 @@ pub(crate) fn cmd_evolog(
|
||||
&language,
|
||||
&get_node_template(graph_style, workspace_command.settings())?,
|
||||
)?
|
||||
.labeled(["node"]);
|
||||
.labeled(["log", "node"]);
|
||||
}
|
||||
|
||||
ui.request_pager();
|
||||
|
@ -177,7 +177,7 @@ pub(crate) fn cmd_log(
|
||||
.labeled(["log"]);
|
||||
node_template = workspace_command
|
||||
.parse_template(ui, &language, &get_node_template(graph_style, settings)?)?
|
||||
.labeled(["node"]);
|
||||
.labeled(["log", "node"]);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ fn do_op_log(
|
||||
.labeled(["op_log", "operation"]);
|
||||
op_node_template = workspace_env
|
||||
.parse_template(ui, &language, &get_node_template(graph_style, settings)?)?
|
||||
.labeled(["node"]);
|
||||
.labeled(["op_log", "operation", "node"]);
|
||||
}
|
||||
|
||||
let diff_formats = diff_formats_for_log(settings, &args.diff_format, args.patch)?;
|
||||
|
@ -457,35 +457,35 @@ fn test_log_builtin_templates_colored_debug() {
|
||||
.success();
|
||||
|
||||
insta::assert_snapshot!(render(r#"builtin_log_oneline"#), @r"
|
||||
[1m[38;5;2m<<node working_copy::@>>[0m [1m[38;5;13m<<log working_copy change_id shortest prefix::r>>[38;5;8m<<log working_copy change_id shortest rest::lvkpnrz>>[39m<<log working_copy:: >>[38;5;9m<<log working_copy email placeholder::(no email set)>>[39m<<log working_copy:: >>[38;5;14m<<log working_copy committer timestamp local format::2001-02-03 08:05:08>>[39m<<log working_copy:: >>[38;5;13m<<log working_copy bookmarks name::my-bookmark>>[39m<<log working_copy:: >>[38;5;12m<<log working_copy commit_id shortest prefix::a>>[38;5;8m<<log working_copy commit_id shortest rest::ec3ec96>>[39m<<log working_copy:: >>[38;5;10m<<log working_copy empty::(empty)>>[39m<<log working_copy:: >>[38;5;10m<<log working_copy empty description placeholder::(no description set)>>[39m<<log working_copy::>>[0m
|
||||
<<node::○>> [1m[38;5;5m<<log change_id shortest prefix::q>>[0m[38;5;8m<<log change_id shortest rest::pvuntsm>>[39m<<log:: >>[38;5;3m<<log author email local::test.user>>[39m<<log:: >>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::e>>[0m[38;5;8m<<log commit_id shortest rest::8849ae1>>[39m<<log:: >>[38;5;2m<<log empty::(empty)>>[39m<<log:: >>[38;5;2m<<log empty description placeholder::(no description set)>>[39m<<log::>>
|
||||
[1m[38;5;14m<<node immutable::◆>>[0m [1m[38;5;5m<<log change_id shortest prefix::z>>[0m[38;5;8m<<log change_id shortest rest::zzzzzzz>>[39m<<log:: >>[38;5;2m<<log root::root()>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::0>>[0m[38;5;8m<<log commit_id shortest rest::0000000>>[39m<<log::>>
|
||||
[1m[38;5;2m<<log node working_copy::@>>[0m [1m[38;5;13m<<log working_copy change_id shortest prefix::r>>[38;5;8m<<log working_copy change_id shortest rest::lvkpnrz>>[39m<<log working_copy:: >>[38;5;9m<<log working_copy email placeholder::(no email set)>>[39m<<log working_copy:: >>[38;5;14m<<log working_copy committer timestamp local format::2001-02-03 08:05:08>>[39m<<log working_copy:: >>[38;5;13m<<log working_copy bookmarks name::my-bookmark>>[39m<<log working_copy:: >>[38;5;12m<<log working_copy commit_id shortest prefix::a>>[38;5;8m<<log working_copy commit_id shortest rest::ec3ec96>>[39m<<log working_copy:: >>[38;5;10m<<log working_copy empty::(empty)>>[39m<<log working_copy:: >>[38;5;10m<<log working_copy empty description placeholder::(no description set)>>[39m<<log working_copy::>>[0m
|
||||
<<log node::○>> [1m[38;5;5m<<log change_id shortest prefix::q>>[0m[38;5;8m<<log change_id shortest rest::pvuntsm>>[39m<<log:: >>[38;5;3m<<log author email local::test.user>>[39m<<log:: >>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::e>>[0m[38;5;8m<<log commit_id shortest rest::8849ae1>>[39m<<log:: >>[38;5;2m<<log empty::(empty)>>[39m<<log:: >>[38;5;2m<<log empty description placeholder::(no description set)>>[39m<<log::>>
|
||||
[1m[38;5;14m<<log node immutable::◆>>[0m [1m[38;5;5m<<log change_id shortest prefix::z>>[0m[38;5;8m<<log change_id shortest rest::zzzzzzz>>[39m<<log:: >>[38;5;2m<<log root::root()>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::0>>[0m[38;5;8m<<log commit_id shortest rest::0000000>>[39m<<log::>>
|
||||
[EOF]
|
||||
");
|
||||
|
||||
insta::assert_snapshot!(render(r#"builtin_log_compact"#), @r"
|
||||
[1m[38;5;2m<<node working_copy::@>>[0m [1m[38;5;13m<<log working_copy change_id shortest prefix::r>>[38;5;8m<<log working_copy change_id shortest rest::lvkpnrz>>[39m<<log working_copy:: >>[38;5;9m<<log working_copy email placeholder::(no email set)>>[39m<<log working_copy:: >>[38;5;14m<<log working_copy committer timestamp local format::2001-02-03 08:05:08>>[39m<<log working_copy:: >>[38;5;13m<<log working_copy bookmarks name::my-bookmark>>[39m<<log working_copy:: >>[38;5;12m<<log working_copy commit_id shortest prefix::a>>[38;5;8m<<log working_copy commit_id shortest rest::ec3ec96>>[39m<<log working_copy::>>[0m
|
||||
[1m[38;5;2m<<log node working_copy::@>>[0m [1m[38;5;13m<<log working_copy change_id shortest prefix::r>>[38;5;8m<<log working_copy change_id shortest rest::lvkpnrz>>[39m<<log working_copy:: >>[38;5;9m<<log working_copy email placeholder::(no email set)>>[39m<<log working_copy:: >>[38;5;14m<<log working_copy committer timestamp local format::2001-02-03 08:05:08>>[39m<<log working_copy:: >>[38;5;13m<<log working_copy bookmarks name::my-bookmark>>[39m<<log working_copy:: >>[38;5;12m<<log working_copy commit_id shortest prefix::a>>[38;5;8m<<log working_copy commit_id shortest rest::ec3ec96>>[39m<<log working_copy::>>[0m
|
||||
│ [1m[38;5;10m<<log working_copy empty::(empty)>>[39m<<log working_copy:: >>[38;5;10m<<log working_copy empty description placeholder::(no description set)>>[39m<<log working_copy::>>[0m
|
||||
<<node::○>> [1m[38;5;5m<<log change_id shortest prefix::q>>[0m[38;5;8m<<log change_id shortest rest::pvuntsm>>[39m<<log:: >>[38;5;3m<<log author email local::test.user>><<log author email::@>><<log author email domain::example.com>>[39m<<log:: >>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::e>>[0m[38;5;8m<<log commit_id shortest rest::8849ae1>>[39m<<log::>>
|
||||
<<log node::○>> [1m[38;5;5m<<log change_id shortest prefix::q>>[0m[38;5;8m<<log change_id shortest rest::pvuntsm>>[39m<<log:: >>[38;5;3m<<log author email local::test.user>><<log author email::@>><<log author email domain::example.com>>[39m<<log:: >>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::e>>[0m[38;5;8m<<log commit_id shortest rest::8849ae1>>[39m<<log::>>
|
||||
│ [38;5;2m<<log empty::(empty)>>[39m<<log:: >>[38;5;2m<<log empty description placeholder::(no description set)>>[39m<<log::>>
|
||||
[1m[38;5;14m<<node immutable::◆>>[0m [1m[38;5;5m<<log change_id shortest prefix::z>>[0m[38;5;8m<<log change_id shortest rest::zzzzzzz>>[39m<<log:: >>[38;5;2m<<log root::root()>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::0>>[0m[38;5;8m<<log commit_id shortest rest::0000000>>[39m<<log::>>
|
||||
[1m[38;5;14m<<log node immutable::◆>>[0m [1m[38;5;5m<<log change_id shortest prefix::z>>[0m[38;5;8m<<log change_id shortest rest::zzzzzzz>>[39m<<log:: >>[38;5;2m<<log root::root()>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::0>>[0m[38;5;8m<<log commit_id shortest rest::0000000>>[39m<<log::>>
|
||||
[EOF]
|
||||
");
|
||||
|
||||
insta::assert_snapshot!(render(r#"builtin_log_comfortable"#), @r"
|
||||
[1m[38;5;2m<<node working_copy::@>>[0m [1m[38;5;13m<<log working_copy change_id shortest prefix::r>>[38;5;8m<<log working_copy change_id shortest rest::lvkpnrz>>[39m<<log working_copy:: >>[38;5;9m<<log working_copy email placeholder::(no email set)>>[39m<<log working_copy:: >>[38;5;14m<<log working_copy committer timestamp local format::2001-02-03 08:05:08>>[39m<<log working_copy:: >>[38;5;13m<<log working_copy bookmarks name::my-bookmark>>[39m<<log working_copy:: >>[38;5;12m<<log working_copy commit_id shortest prefix::a>>[38;5;8m<<log working_copy commit_id shortest rest::ec3ec96>>[39m<<log working_copy::>>[0m
|
||||
[1m[38;5;2m<<log node working_copy::@>>[0m [1m[38;5;13m<<log working_copy change_id shortest prefix::r>>[38;5;8m<<log working_copy change_id shortest rest::lvkpnrz>>[39m<<log working_copy:: >>[38;5;9m<<log working_copy email placeholder::(no email set)>>[39m<<log working_copy:: >>[38;5;14m<<log working_copy committer timestamp local format::2001-02-03 08:05:08>>[39m<<log working_copy:: >>[38;5;13m<<log working_copy bookmarks name::my-bookmark>>[39m<<log working_copy:: >>[38;5;12m<<log working_copy commit_id shortest prefix::a>>[38;5;8m<<log working_copy commit_id shortest rest::ec3ec96>>[39m<<log working_copy::>>[0m
|
||||
│ [1m[38;5;10m<<log working_copy empty::(empty)>>[39m<<log working_copy:: >>[38;5;10m<<log working_copy empty description placeholder::(no description set)>>[39m<<log working_copy::>>[0m
|
||||
│ <<log::>>
|
||||
<<node::○>> [1m[38;5;5m<<log change_id shortest prefix::q>>[0m[38;5;8m<<log change_id shortest rest::pvuntsm>>[39m<<log:: >>[38;5;3m<<log author email local::test.user>><<log author email::@>><<log author email domain::example.com>>[39m<<log:: >>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::e>>[0m[38;5;8m<<log commit_id shortest rest::8849ae1>>[39m<<log::>>
|
||||
<<log node::○>> [1m[38;5;5m<<log change_id shortest prefix::q>>[0m[38;5;8m<<log change_id shortest rest::pvuntsm>>[39m<<log:: >>[38;5;3m<<log author email local::test.user>><<log author email::@>><<log author email domain::example.com>>[39m<<log:: >>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::e>>[0m[38;5;8m<<log commit_id shortest rest::8849ae1>>[39m<<log::>>
|
||||
│ [38;5;2m<<log empty::(empty)>>[39m<<log:: >>[38;5;2m<<log empty description placeholder::(no description set)>>[39m<<log::>>
|
||||
│ <<log::>>
|
||||
[1m[38;5;14m<<node immutable::◆>>[0m [1m[38;5;5m<<log change_id shortest prefix::z>>[0m[38;5;8m<<log change_id shortest rest::zzzzzzz>>[39m<<log:: >>[38;5;2m<<log root::root()>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::0>>[0m[38;5;8m<<log commit_id shortest rest::0000000>>[39m<<log::>>
|
||||
[1m[38;5;14m<<log node immutable::◆>>[0m [1m[38;5;5m<<log change_id shortest prefix::z>>[0m[38;5;8m<<log change_id shortest rest::zzzzzzz>>[39m<<log:: >>[38;5;2m<<log root::root()>>[39m<<log:: >>[1m[38;5;4m<<log commit_id shortest prefix::0>>[0m[38;5;8m<<log commit_id shortest rest::0000000>>[39m<<log::>>
|
||||
<<log::>>
|
||||
[EOF]
|
||||
");
|
||||
|
||||
insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r"
|
||||
[1m[38;5;2m<<node working_copy::@>>[0m <<log::Commit ID: >>[38;5;4m<<log commit_id::aec3ec964d0771edea9da48a2a170bc6ffa1c725>>[39m<<log::>>
|
||||
[1m[38;5;2m<<log node working_copy::@>>[0m <<log::Commit ID: >>[38;5;4m<<log commit_id::aec3ec964d0771edea9da48a2a170bc6ffa1c725>>[39m<<log::>>
|
||||
│ <<log::Change ID: >>[38;5;5m<<log change_id::rlvkpnrzqnoowoytxnquwvuryrwnrmlp>>[39m<<log::>>
|
||||
│ <<log::Bookmarks: >>[38;5;5m<<log local_bookmarks name::my-bookmark>>[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::)>>
|
||||
@ -493,14 +493,14 @@ fn test_log_builtin_templates_colored_debug() {
|
||||
│ <<log::>>
|
||||
│ [38;5;2m<<log empty description placeholder:: (no description set)>>[39m<<log::>>
|
||||
│ <<log::>>
|
||||
<<node::○>> <<log::Commit ID: >>[38;5;4m<<log commit_id::e8849ae12c709f2321908879bc724fdb2ab8a781>>[39m<<log::>>
|
||||
<<log node::○>> <<log::Commit ID: >>[38;5;4m<<log commit_id::e8849ae12c709f2321908879bc724fdb2ab8a781>>[39m<<log::>>
|
||||
│ <<log::Change ID: >>[38;5;5m<<log change_id::qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu>>[39m<<log::>>
|
||||
│ <<log::Author : >>[38;5;3m<<log author name::Test User>>[39m<<log:: <>>[38;5;3m<<log author email local::test.user>><<log author email::@>><<log author email domain::example.com>>[39m<<log::> (>>[38;5;6m<<log author timestamp local format::2001-02-03 08:05:07>>[39m<<log::)>>
|
||||
│ <<log::Committer: >>[38;5;3m<<log committer name::Test User>>[39m<<log:: <>>[38;5;3m<<log committer email local::test.user>><<log committer email::@>><<log committer email domain::example.com>>[39m<<log::> (>>[38;5;6m<<log committer timestamp local format::2001-02-03 08:05:07>>[39m<<log::)>>
|
||||
│ <<log::>>
|
||||
│ [38;5;2m<<log empty description placeholder:: (no description set)>>[39m<<log::>>
|
||||
│ <<log::>>
|
||||
[1m[38;5;14m<<node immutable::◆>>[0m <<log::Commit ID: >>[38;5;4m<<log commit_id::0000000000000000000000000000000000000000>>[39m<<log::>>
|
||||
[1m[38;5;14m<<log node immutable::◆>>[0m <<log::Commit ID: >>[38;5;4m<<log commit_id::0000000000000000000000000000000000000000>>[39m<<log::>>
|
||||
<<log::Change ID: >>[38;5;5m<<log change_id::zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz>>[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: >>[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 committer timestamp local format::1970-01-01 11:00:00>>[39m<<log::)>>
|
||||
|
@ -1180,11 +1180,11 @@ fn test_graph_template_color() {
|
||||
");
|
||||
let output = work_dir.run_jj(["--color=debug", "log", "-T", template]);
|
||||
insta::assert_snapshot!(output, @r"
|
||||
[1m[38;5;2m<<node working_copy::@>>[0m [1m[38;5;2m<<log working_copy description::single line>>[0m
|
||||
<<node::○>> [38;5;1m<<log description::first line>>[39m
|
||||
[1m[38;5;2m<<log node working_copy::@>>[0m [1m[38;5;2m<<log working_copy description::single line>>[0m
|
||||
<<log node::○>> [38;5;1m<<log description::first line>>[39m
|
||||
│ [38;5;1m<<log description::second line>>[39m
|
||||
│ [38;5;1m<<log description::third line>>[39m
|
||||
[1m[38;5;14m<<node immutable::◆>>[0m
|
||||
[1m[38;5;14m<<log node immutable::◆>>[0m
|
||||
[EOF]
|
||||
");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user