Skip to content

Commit

Permalink
templates: Change builtin_log_root to be consistent with other hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
necauqua committed Apr 7, 2024
1 parent e799afb commit 64d9c5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* The default template alias `builtin_op_log_root(op_id: OperationId)` was replaced by `format_root_operation(root: Operation)`.

* The default template alias `builtin_log_root(change_id: ChangeId, commit_id: CommitId)` was replaced by `format_root_commit(root: Commit)`.

### New features

* The list of conflicted paths is printed whenever the working copy changes.
Expand Down
24 changes: 12 additions & 12 deletions cli/src/config/templates.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ show = 'builtin_log_detailed'
[template-aliases]
builtin_log_oneline = '''
if(root,
builtin_log_root(change_id, commit_id),
format_root_commit(self),
label(if(current_working_copy, "working_copy"),
concat(
separate(" ",
Expand All @@ -64,7 +64,7 @@ if(root,
'''
builtin_log_compact = '''
if(root,
builtin_log_root(change_id, commit_id),
format_root_commit(self),
label(if(current_working_copy, "working_copy"),
concat(
separate(" ",
Expand All @@ -87,7 +87,7 @@ if(root,
)
'''
builtin_log_comfortable = 'builtin_log_compact ++ "\n"'
'builtin_log_detailed' = '''
builtin_log_detailed = '''
concat(
"Commit ID: " ++ commit_id ++ "\n",
"Change ID: " ++ change_id ++ "\n",
Expand All @@ -112,15 +112,6 @@ label(if(current_operation, "current_operation"),
'''
builtin_op_log_comfortable = 'builtin_op_log_compact ++ "\n"'

'builtin_log_root(change_id, commit_id)' = '''
separate(" ",
format_short_change_id(change_id),
label("root", "root()"),
format_short_commit_id(commit_id),
branches
) ++ "\n"
'''


description_placeholder = '''
label(if(empty, "empty ") ++ "description placeholder", "(no description set)")'''
Expand All @@ -142,6 +133,15 @@ commit_summary_separator = 'label("separator", " | ")'
time_range.start().ago() ++ label("time", ", lasted ") ++ time_range.duration()'''
'format_timestamp(timestamp)' = 'timestamp.local().format("%Y-%m-%d %H:%M:%S")'

'format_root_commit(root)' = '''
separate(" ",
format_short_change_id(root.change_id()),
label("root", "root()"),
format_short_commit_id(root.commit_id()),
root.branches()
) ++ "\n"
'''

'format_operation(op)' = '''
concat(
separate(" ", op.id().short(), op.user(), format_time_range(op.time())), "\n",
Expand Down

0 comments on commit 64d9c5b

Please sign in to comment.