From c4672c65b18495e7e7fc5668217ba64f85f536be Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Mon, 14 Oct 2024 10:48:51 -0700 Subject: [PATCH] formatter & colors.toml: replace `op_log` color label Cleans up after 7051effa8f It's split into "operation op_log" and just "operation" for the summaries (as suggested by Yuya). The color labels use "operation". --- CHANGELOG.md | 5 +++++ cli/src/cli_util.rs | 7 +------ cli/src/commands/operation/log.rs | 3 ++- cli/src/commands/operation/show.rs | 2 +- cli/src/config/colors.toml | 14 +++++++------- cli/tests/test_operations.rs | 6 +++--- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ff11507..733fa32f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). * Help command doesn't work recursively anymore, i.e. `jj workspace help root` doesn't work anymore. +* The color label `op_log` from the `[colors]` config section now **only** + applies to the op log and not to the other places operations are displayed. In + almost all cases, if you configured `op_log` before, you should use the new + `operation` label instead. + * Default operation log template now shows end times of operations instead of start times. diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index c95252d0e..b40116c6d 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1492,12 +1492,7 @@ impl WorkspaceCommandHelper { &self.op_summary_template_text, OperationTemplateLanguage::wrap_operation, ) - // TODO: "op_log" is not a great label name for op_summary. We could - // replace it with `operation summary` and use `operation` in - // colors.toml. TODO: It would be better to put labels like these - // consistently in the same place, e.g. `templates.toml` instead of the - // rust code. - .labeled("op_log") + .labeled("operation") } pub fn short_change_id_template(&self) -> TemplateRenderer<'_, Commit> { diff --git a/cli/src/commands/operation/log.rs b/cli/src/commands/operation/log.rs index 03308172e..67b5ae19e 100644 --- a/cli/src/commands/operation/log.rs +++ b/cli/src/commands/operation/log.rs @@ -130,7 +130,8 @@ fn do_op_log( &text, OperationTemplateLanguage::wrap_operation, )? - .labeled("op_log"); + .labeled("op_log") + .labeled("operation"); op_node_template = workspace_env .parse_template( ui, diff --git a/cli/src/commands/operation/show.rs b/cli/src/commands/operation/show.rs index bc67e19b2..8be3aed53 100644 --- a/cli/src/commands/operation/show.rs +++ b/cli/src/commands/operation/show.rs @@ -82,7 +82,7 @@ pub fn cmd_op_show( let text = command.settings().config().get_string("templates.op_log")?; workspace_command .parse_operation_template(ui, &text)? - .labeled("op_log") + .labeled("operation") }; ui.request_pager(); diff --git a/cli/src/config/colors.toml b/cli/src/config/colors.toml index 66741f485..e14763d2d 100644 --- a/cli/src/config/colors.toml +++ b/cli/src/config/colors.toml @@ -97,13 +97,13 @@ "diff copied" = "green" "diff access-denied" = { bg = "red" } -"op_log id" = "blue" -"op_log user" = "yellow" -"op_log time" = "cyan" -"op_log current_operation" = { bold = true } -"op_log current_operation id" = "bright blue" -"op_log current_operation user" = "yellow" # No bright yellow, see comment above -"op_log current_operation time" = "bright cyan" +"operation id" = "blue" +"operation user" = "yellow" +"operation time" = "cyan" +"operation current_operation" = { bold = true } +"operation current_operation id" = "bright blue" +"operation current_operation user" = "yellow" # No bright yellow, see comment above +"operation current_operation time" = "bright cyan" "node elided" = { fg = "bright black" } "node working_copy" = { fg = "green", bold = true } diff --git a/cli/tests/test_operations.rs b/cli/tests/test_operations.rs index 8aac187c5..710b6e40e 100644 --- a/cli/tests/test_operations.rs +++ b/cli/tests/test_operations.rs @@ -820,7 +820,7 @@ fn test_op_summary_diff_template() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "undo", "--color=debug"]); insta::assert_snapshot!(&stdout, @""); insta::assert_snapshot!(&stderr, @r#" - Undid operation: <><><><><> + Undid operation: <><><><><> "#); let stdout = test_env.jj_cmd_success( &repo_path, @@ -835,8 +835,8 @@ fn test_op_summary_diff_template() { ], ); insta::assert_snapshot!(&stdout, @r#" - From operation: <><><> - To operation: <><><><><> + From operation: <><><> + To operation: <><><><><> Changed commits: ○ Change qpvuntsmwlqt