Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
directly as positional arguments, such as
`jj bisect --range=..main -- cargo check --all-targets`.

* The default alias for formatting time ranges, used by `jj op log`,
now shows the absolute local end time and duration.

### Fixed bugs

* `jj metaedit --author-timestamp` twice with the same value no longer
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config/templates.toml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ commit_summary_separator = 'label("separator", " | ")'
# the moment when the repo was actually modified due to this operation. TODO:
# This macro might need a better name, e.g. `format_operation_time_range`.
'format_time_range(time_range)' = '''
time_range.end().ago() ++ label("time", ", lasted ") ++ time_range.duration()'''
format_timestamp(time_range.end()) ++ label("time", ", lasted ") ++ time_range.duration()'''
'format_timestamp(timestamp)' = 'timestamp.local().format("%Y-%m-%d %H:%M:%S")'

'format_commit_summary_with_refs(commit, refs)' = '''
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/test_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ fn test_op_log_template() {
[EOF]
"#);

// Test the default template, i.e. with relative start time and duration. We
// don't generally use that template because it depends on the current time,
// so we need to reset the time range format here.
// Test a template with relative start time and duration, a previous default.
// We don't generally use this style of template because it depends on the
// current time, so we need to reset the time range format here.
test_env.add_config(
r#"
[template-aliases]
Expand Down
6 changes: 3 additions & 3 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,12 @@ 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 the `format_time_range()` template alias.
`jj op log` displays elapsed time with absolute local timestamps. To use relative
timestamps, you will need to modify the `format_time_range()` template alias.

```toml
[template-aliases]
'format_time_range(time_range)' = 'time_range.start() ++ " - " ++ time_range.end()'
'format_time_range(time_range)' = 'time_range.end().ago() ++ label("time", ", lasted ") ++ time_range.duration()'
```

### Author format
Expand Down
2 changes: 1 addition & 1 deletion docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ui.merge-editor = "meld" # default
# ui.merge-editor = "kdiff3"

# Relative timestamp rendered as "x days/hours/seconds ago"
template-aliases.'format_timestamp(timestamp)' = 'timestamp.ago()'
# template-aliases.'format_timestamp(timestamp)' = 'timestamp.ago()'

# The four merge tools listed above are pre-configured. For detailed information
# about how to change the default configuration or how to configure another tool,
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,16 +393,16 @@ commands to interact with it. To list the operations, use `jj op log`:

```shell
$ jj op log
@ d3b77addea49 [email protected] 3 minutes ago, lasted 3 milliseconds
@ d3b77addea49 [email protected] 2025-05-12 00:27:27, lasted 3 milliseconds
│ squash commits into f7fb5943a6b9460eb106dba2fac5cac1625c6f7a
│ args: jj squash
○ 6fc1873c1180 [email protected] 3 minutes ago, lasted 1 milliseconds
○ 6fc1873c1180 [email protected] 2025-05-12 00:27:27, lasted 1 milliseconds
│ snapshot working copy
│ args: jj st
○ ed91f7bcc1fb [email protected] 6 minutes ago, lasted 1 milliseconds
○ ed91f7bcc1fb [email protected] 2025-05-12 00:24:21, lasted 1 milliseconds
│ new empty commit
│ args: jj new puqltutt
○ 367400773f87 [email protected] 12 minutes ago, lasted 3 milliseconds
○ 367400773f87 [email protected] 2025-05-12 00:18:08, lasted 3 milliseconds
│ rebase commit daa6ffd5a09a8a7d09a65796194e69b7ed0a566d and descendants
│ args: jj rebase -s puqltutt -d nuvyytnq
[many more lines]
Expand Down