From e4aa2cb2e54abe9c465e2a424580a3143097cb33 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Wed, 15 Feb 2023 19:26:31 -0800 Subject: [PATCH] Rename `ui.relative-timestamps` to `ui.oplog-relative-timestamps` --- CHANGELOG.md | 9 +++++---- docs/config.md | 8 ++++++++ lib/src/settings.rs | 4 ++-- src/commands/operation.rs | 2 +- src/config-schema.json | 2 +- tests/test_operations.rs | 7 ++++++- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbfcdc825..323a3678b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,11 +42,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `label(if(current_working_copy, "working_copy"), ...)` to label the working-copy entry. -* `jj log` and `jj show` no longer respect `ui.relative-timestamps = true`. - Use the `format_timestamp()` template alias instead. For details, see - [the documentation](docs/config.md). +* The `ui.relative-timestamps` option has been removed. Use the + `format_timestamp()` template alias instead. For details on showing relative + timestamps in `jj log` and `jj show`, see [the documentation](docs/config.md). -* `jj op log` now shows relative timestamps by default. To disable, set `ui.relative-timestamps` to `false`. +* `jj op log` now shows relative timestamps by default. To disable, set + `ui.oplog-relative-timestamps` to `false`. * The global `--no-commit-working-copy` is now called `--ignore-working-copy`. diff --git a/docs/config.md b/docs/config.md index a5baeaf09..02b3c71eb 100644 --- a/docs/config.md +++ b/docs/config.md @@ -140,6 +140,14 @@ Can be customized by the `format_timestamp()` template alias. 'format_timestamp(timestamp)' = 'timestamp.ago()' ``` +`jj op log` defaults to relative timestamps. To use absolute timestamps, you +will need to modify an option. + +```toml +[ui] +oplog-relative-timestamps=false +``` + ### Author format Can be customized by the `format_short_signature()` template alias. diff --git a/lib/src/settings.rs b/lib/src/settings.rs index ceb2174e7..cb73b2afd 100644 --- a/lib/src/settings.rs +++ b/lib/src/settings.rs @@ -158,9 +158,9 @@ impl UserSettings { .unwrap_or(false) } - pub fn relative_timestamps(&self) -> bool { + pub fn oplog_relative_timestamps(&self) -> bool { self.config - .get_bool("ui.relative-timestamps") + .get_bool("ui.oplog-relative-timestamps") .unwrap_or(true) } diff --git a/src/commands/operation.rs b/src/commands/operation.rs index 16d9a01b0..30753e7c1 100644 --- a/src/commands/operation.rs +++ b/src/commands/operation.rs @@ -105,7 +105,7 @@ fn cmd_op_log( } } let template = OpTemplate { - relative_timestamps: command.settings().relative_timestamps(), + relative_timestamps: command.settings().oplog_relative_timestamps(), }; let mut graph = get_graphlog(command.settings(), formatter.raw()); diff --git a/src/config-schema.json b/src/config-schema.json index 1d4f4b256..2987719aa 100644 --- a/src/config-schema.json +++ b/src/config-schema.json @@ -51,7 +51,7 @@ "description": "Whether to allow initializing a repo with the native backend", "default": false }, - "relative-timestamps": { + "oplog-relative-timestamps": { "type": "boolean", "description": "Whether to change timestamps in the op log to be rendered as a relative description instead of a full timestamp", "default": true diff --git a/tests/test_operations.rs b/tests/test_operations.rs index a529f1fc0..8dbe5cf68 100644 --- a/tests/test_operations.rs +++ b/tests/test_operations.rs @@ -29,7 +29,12 @@ fn test_op_log() { let stdout = test_env.jj_cmd_success( &repo_path, - &["op", "log", "--config-toml", "ui.relative-timestamps=false"], + &[ + "op", + "log", + "--config-toml", + "ui.oplog-relative-timestamps=false", + ], ); insta::assert_snapshot!(&stdout, @r###" @ 45108169c0f8 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00