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

Templater: change some names from "shortest" to "short"

This matches the templater function name
This commit is contained in:
Ilya Grigoriev 2023-01-14 18:43:14 -08:00
parent 68ad712e12
commit dae42ea34a
2 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ use pest_derive::Parser;
use crate::formatter::PlainTextFormatter;
use crate::templater::{
AuthorProperty, BranchProperty, CommitOrChangeId, CommitOrChangeIdKeyword,
CommitOrChangeIdShortest, CommitterProperty, ConditionalTemplate, ConflictProperty,
CommitOrChangeIdShort, CommitterProperty, ConditionalTemplate, ConflictProperty,
ConstantTemplateProperty, DescriptionProperty, DivergentProperty, DynamicLabelTemplate,
EmptyProperty, GitRefsProperty, IsGitHeadProperty, IsWorkingCopyProperty, LabelTemplate,
ListTemplate, LiteralTemplate, SignatureTimestamp, StringPropertyTemplate, TagProperty,
@ -208,7 +208,7 @@ fn parse_commit_or_chain_id_method<'a>(
// TODO: validate arguments
let this_function = match name.as_str() {
"short" => Property::String(Box::new(CommitOrChangeIdShortest)),
"short" => Property::String(Box::new(CommitOrChangeIdShort)),
name => panic!("no such commit ID method: {name}"),
};
let chain_method = inner.last().unwrap();

View file

@ -441,16 +441,16 @@ impl CommitOrChangeIdKeyword {
commit_or_change_id.hex()
}
pub fn shortest_format(commit_or_change_id: CommitOrChangeId) -> String {
pub fn short_format(commit_or_change_id: CommitOrChangeId) -> String {
commit_or_change_id.hex()[..12].to_string()
}
}
pub struct CommitOrChangeIdShortest;
pub struct CommitOrChangeIdShort;
impl TemplateProperty<CommitOrChangeId, String> for CommitOrChangeIdShortest {
impl TemplateProperty<CommitOrChangeId, String> for CommitOrChangeIdShort {
fn extract(&self, context: &CommitOrChangeId) -> String {
CommitOrChangeIdKeyword::shortest_format(context.clone())
CommitOrChangeIdKeyword::short_format(context.clone())
}
}