ok/jj
1
0
Fork 0
forked from mirrors/jj

Make ui.relative-timestamps default to true

This seems like a better default for `jj op log`, which is now the only thing
this option affects.
This commit is contained in:
Ilya Grigoriev 2023-02-15 19:19:41 -08:00
parent bb6bad18ad
commit 859b0f680c
5 changed files with 14 additions and 14 deletions

View file

@ -46,6 +46,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Use the `format_timestamp()` template alias instead. For details, see
[the documentation](docs/config.md).
* `jj op log` now shows relative timestamps by default. To disable, set `ui.relative-timestamps` to `false`.
* The global `--no-commit-working-copy` is now called `--ignore-working-copy`.
* The `diff.format` config option is now called `ui.diff.format`. The old name
@ -85,8 +87,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Per-repository configuration is now read from `.jj/repo/config.toml`.
* The `ui.relative-timestamps` option now affects `jj op log`.
* Background colors, bold text, and underlining are now supported. You can set
e.g. `color.error = { bg = "red", bold = true, underline = true }` in your
`~/.jjconfig.toml`.

View file

@ -161,7 +161,7 @@ impl UserSettings {
pub fn relative_timestamps(&self) -> bool {
self.config
.get_bool("ui.relative-timestamps")
.unwrap_or(false)
.unwrap_or(true)
}
pub fn config(&self) -> &config::Config {

View file

@ -53,8 +53,8 @@
},
"relative-timestamps": {
"type": "boolean",
"description": "Whether to change timestamps to be rendered as a relative description instead of a full timestamp",
"default": false
"description": "Whether to change timestamps in the op log to be rendered as a relative description instead of a full timestamp",
"default": true
},
"default-revset": {
"type": "string",

View file

@ -51,14 +51,14 @@ fn test_concurrent_operations_auto_rebase() {
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "initial"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
insta::assert_snapshot!(stdout, @r###"
@ eac5ad986688 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
@ eac5ad986688 test-username@host.example.com 22 years ago, lasted less than a microsecond
describe commit 123ed18e4c4c0d77428df41112bc02ffc83fb935
args: jj describe -m initial
o 09a674690d20 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00
o 09a674690d20 test-username@host.example.com 22 years ago, lasted less than a microsecond
snapshot working copy
o a99a3fd5c51e test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
o a99a3fd5c51e test-username@host.example.com 22 years ago, lasted less than a microsecond
add workspace 'default'
o 56b94dfc38e7 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00
o 56b94dfc38e7 test-username@host.example.com 22 years ago, lasted less than a microsecond
initialize repo
"###);
let op_id_hex = stdout[3..15].to_string();

View file

@ -27,7 +27,10 @@ fn test_op_log() {
let repo_path = test_env.env_root().join("repo");
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "description 0"]);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
let stdout = test_env.jj_cmd_success(
&repo_path,
&["op", "log", "--config-toml", "ui.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
describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22
@ -38,10 +41,7 @@ fn test_op_log() {
initialize repo
"###);
// Test op log with relative dates
let stdout = test_env.jj_cmd_success(
&repo_path,
&["op", "log", "--config-toml", "ui.relative-timestamps=true"],
);
let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]);
let regex = Regex::new(r"\d\d years").unwrap();
insta::assert_snapshot!(regex.replace_all(&stdout, "NN years"), @r###"
@ 45108169c0f8 test-username@host.example.com NN years ago, lasted less than a microsecond