forked from mirrors/jj
cli branch list
: use separate short commit template
We will shortly add branches to the short commit template, but that is undesireable for `jj branch list`.
This commit is contained in:
parent
17b45d642f
commit
355b93fdd6
2 changed files with 19 additions and 3 deletions
|
@ -368,12 +368,18 @@ fn cmd_branch_list(
|
|||
});
|
||||
}
|
||||
|
||||
let no_branches_template = workspace_command.parse_commit_template(
|
||||
&command
|
||||
.settings()
|
||||
.config()
|
||||
.get_string("templates.commit_summary_no_branches")?,
|
||||
)?;
|
||||
let print_branch_target =
|
||||
|formatter: &mut dyn Formatter, target: &RefTarget| -> Result<(), CommandError> {
|
||||
if let Some(id) = target.as_normal() {
|
||||
write!(formatter, ": ")?;
|
||||
let commit = repo.store().get_commit(id)?;
|
||||
workspace_command.write_commit_summary(formatter, &commit)?;
|
||||
no_branches_template.format(&commit, formatter)?;
|
||||
writeln!(formatter)?;
|
||||
} else {
|
||||
write!(formatter, " ")?;
|
||||
|
@ -382,13 +388,13 @@ fn cmd_branch_list(
|
|||
for id in target.removed_ids() {
|
||||
let commit = repo.store().get_commit(id)?;
|
||||
write!(formatter, " - ")?;
|
||||
workspace_command.write_commit_summary(formatter, &commit)?;
|
||||
no_branches_template.format(&commit, formatter)?;
|
||||
writeln!(formatter)?;
|
||||
}
|
||||
for id in target.added_ids() {
|
||||
let commit = repo.store().get_commit(id)?;
|
||||
write!(formatter, " + ")?;
|
||||
workspace_command.write_commit_summary(formatter, &commit)?;
|
||||
no_branches_template.format(&commit, formatter)?;
|
||||
writeln!(formatter)?;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,16 @@ separate(" ",
|
|||
)
|
||||
'''
|
||||
|
||||
commit_summary_no_branches = '''
|
||||
separate(" ",
|
||||
format_short_change_id(change_id),
|
||||
format_short_commit_id(commit_id),
|
||||
if(conflict, label("conflict", "(conflict)")),
|
||||
if(empty, label("empty", "(empty)")),
|
||||
if(description, description.first_line(), description_placeholder),
|
||||
)
|
||||
'''
|
||||
|
||||
log = 'builtin_log_compact'
|
||||
op_log = 'builtin_op_log_compact'
|
||||
show = 'builtin_log_detailed'
|
||||
|
|
Loading…
Reference in a new issue