Rename ui.relative-timestamps to ui.oplog-relative-timestamps

This commit is contained in:
Ilya Grigoriev 2023-02-15 19:26:31 -08:00
parent 859b0f680c
commit e4aa2cb2e5
6 changed files with 23 additions and 9 deletions

View file

@ -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 `label(if(current_working_copy, "working_copy"), ...)` to label the
working-copy entry. working-copy entry.
* `jj log` and `jj show` no longer respect `ui.relative-timestamps = true`. * The `ui.relative-timestamps` option has been removed. Use the
Use the `format_timestamp()` template alias instead. For details, see `format_timestamp()` template alias instead. For details on showing relative
[the documentation](docs/config.md). 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`. * The global `--no-commit-working-copy` is now called `--ignore-working-copy`.

View file

@ -140,6 +140,14 @@ Can be customized by the `format_timestamp()` template alias.
'format_timestamp(timestamp)' = 'timestamp.ago()' '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 ### Author format
Can be customized by the `format_short_signature()` template alias. Can be customized by the `format_short_signature()` template alias.

View file

@ -158,9 +158,9 @@ impl UserSettings {
.unwrap_or(false) .unwrap_or(false)
} }
pub fn relative_timestamps(&self) -> bool { pub fn oplog_relative_timestamps(&self) -> bool {
self.config self.config
.get_bool("ui.relative-timestamps") .get_bool("ui.oplog-relative-timestamps")
.unwrap_or(true) .unwrap_or(true)
} }

View file

@ -105,7 +105,7 @@ fn cmd_op_log(
} }
} }
let template = OpTemplate { 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()); let mut graph = get_graphlog(command.settings(), formatter.raw());

View file

@ -51,7 +51,7 @@
"description": "Whether to allow initializing a repo with the native backend", "description": "Whether to allow initializing a repo with the native backend",
"default": false "default": false
}, },
"relative-timestamps": { "oplog-relative-timestamps": {
"type": "boolean", "type": "boolean",
"description": "Whether to change timestamps in the op log to be rendered as a relative description instead of a full timestamp", "description": "Whether to change timestamps in the op log to be rendered as a relative description instead of a full timestamp",
"default": true "default": true

View file

@ -29,7 +29,12 @@ fn test_op_log() {
let stdout = test_env.jj_cmd_success( let stdout = test_env.jj_cmd_success(
&repo_path, &repo_path,
&["op", "log", "--config-toml", "ui.relative-timestamps=false"], &[
"op",
"log",
"--config-toml",
"ui.oplog-relative-timestamps=false",
],
); );
insta::assert_snapshot!(&stdout, @r###" 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 @ 45108169c0f8 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00