mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-23 20:53:56 +00:00
config: migrate log/show timestamp format away from config knob
Since oplog still relies on ui.relative-timestamps, this config key isn't removed.
This commit is contained in:
parent
a00767bc0f
commit
6316ec7442
4 changed files with 12 additions and 11 deletions
|
@ -42,6 +42,10 @@ 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`.
|
||||||
|
Use the `format_timestamp()` template alias instead. For details, see
|
||||||
|
[the documentation](docs/config.md).
|
||||||
|
|
||||||
* The global `--no-commit-working-copy` is now called `--ignore-working-copy`.
|
* 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
|
* The `diff.format` config option is now called `ui.diff.format`. The old name
|
||||||
|
@ -81,7 +85,7 @@ 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`.
|
* Per-repository configuration is now read from `.jj/repo/config.toml`.
|
||||||
|
|
||||||
* The `ui.relative-timestamps` option now also affects `jj op log`.
|
* The `ui.relative-timestamps` option now affects `jj op log`.
|
||||||
|
|
||||||
* Background colors, bold text, and underlining are now supported. You can set
|
* Background colors, bold text, and underlining are now supported. You can set
|
||||||
e.g. `color.error = { bg = "red", bold = true, underline = true }` in your
|
e.g. `color.error = { bg = "red", bold = true, underline = true }` in your
|
||||||
|
|
|
@ -1548,15 +1548,6 @@ fn load_template_aliases(
|
||||||
// TODO: Reorganize default template aliases and config knobs:
|
// TODO: Reorganize default template aliases and config knobs:
|
||||||
// - remove these configs and let user override aliases?
|
// - remove these configs and let user override aliases?
|
||||||
// - separate namespace or config section for these "default" aliases? but how?
|
// - separate namespace or config section for these "default" aliases? but how?
|
||||||
let timestamp_template = if settings.relative_timestamps() {
|
|
||||||
"timestamp.ago()"
|
|
||||||
} else {
|
|
||||||
"timestamp"
|
|
||||||
};
|
|
||||||
aliases_map
|
|
||||||
.insert("format_timestamp(timestamp)", timestamp_template)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let signature_template = match settings.log_author_format().as_str() {
|
let signature_template = match settings.log_author_format().as_str() {
|
||||||
"none" => r#""""#,
|
"none" => r#""""#,
|
||||||
"full" => "signature",
|
"full" => "signature",
|
||||||
|
|
|
@ -34,6 +34,7 @@ show = 'show'
|
||||||
|
|
||||||
# Hook points for users to customize the default templates:
|
# Hook points for users to customize the default templates:
|
||||||
'format_short_id(id)' = 'id.shortest(12)'
|
'format_short_id(id)' = 'id.shortest(12)'
|
||||||
|
'format_timestamp(timestamp)' = 'timestamp'
|
||||||
|
|
||||||
# TODO: Add branches, tags, etc
|
# TODO: Add branches, tags, etc
|
||||||
# TODO: Indent the description like Git does
|
# TODO: Indent the description like Git does
|
||||||
|
|
|
@ -41,7 +41,12 @@ fn test_show_relative_timestamps() {
|
||||||
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
|
test_env.jj_cmd_success(test_env.env_root(), &["init", "repo", "--git"]);
|
||||||
let repo_path = test_env.env_root().join("repo");
|
let repo_path = test_env.env_root().join("repo");
|
||||||
|
|
||||||
test_env.add_config(r#"ui.relative-timestamps = true"#);
|
test_env.add_config(
|
||||||
|
r#"
|
||||||
|
[template-aliases]
|
||||||
|
'format_timestamp(timestamp)' = 'timestamp.ago()'
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
|
||||||
let stdout = test_env.jj_cmd_success(&repo_path, &["show"]);
|
let stdout = test_env.jj_cmd_success(&repo_path, &["show"]);
|
||||||
let timestamp_re = Regex::new(r"\([0-9]+ years ago\)").unwrap();
|
let timestamp_re = Regex::new(r"\([0-9]+ years ago\)").unwrap();
|
||||||
|
|
Loading…
Reference in a new issue