cli: remove most evolution-related template keywords (#32)

`obsolete`, `orphan`, and `abandoned` almost never appear in log
output these days, so let's remove them.
This commit is contained in:
Martin von Zweigbergk 2021-10-06 22:29:14 -07:00
parent 4c8beee81c
commit a750be2b9b
3 changed files with 3 additions and 40 deletions

View File

@ -1719,9 +1719,6 @@ fn log_template(settings: &UserSettings) -> String {
"branches: " branches "\n"
"tags: " tags "\n"
"open: " open "\n"
"abandoned: " abandoned "\n"
"obsolete: " obsolete "\n"
"orphan: " orphan "\n"
"divergent: " divergent "\n"
"has conflict: " conflict "\n"
description "\n"
@ -1734,7 +1731,7 @@ fn log_template(settings: &UserSettings) -> String {
fn graph_log_template(settings: &UserSettings) -> String {
// TODO: define a method on boolean values, so we can get auto-coloring
// with e.g. `obsolete.then("obsolete")`
// with e.g. `conflict.then("conflict")`
let default_template = r#"
label(if(open, "open"),
commit_id.short()
@ -1743,9 +1740,6 @@ fn graph_log_template(settings: &UserSettings) -> String {
" " label("timestamp", author.timestamp())
" " branches
" " tags
if(abandoned, label("abandoned", " abandoned"))
if(obsolete, label("obsolete", " obsolete"))
if(orphan, label("orphan", " orphan"))
if(divergent, label("divergent", " divergent"))
if(conflict, label("conflict", " conflict"))
"\n"

View File

@ -26,8 +26,8 @@ use crate::templater::{
AuthorProperty, BranchProperty, ChangeIdProperty, CommitIdKeyword, CommitterProperty,
ConditionalTemplate, ConflictProperty, ConstantTemplateProperty, CurrentCheckoutProperty,
DescriptionProperty, DivergentProperty, DynamicLabelTemplate, GitRefsProperty, LabelTemplate,
ListTemplate, LiteralTemplate, ObsoleteProperty, OpenProperty, OrphanProperty, PrunedProperty,
StringPropertyTemplate, TagProperty, Template, TemplateFunction, TemplateProperty,
ListTemplate, LiteralTemplate, OpenProperty, StringPropertyTemplate, TagProperty, Template,
TemplateFunction, TemplateProperty,
};
#[derive(Parser)]
@ -238,13 +238,10 @@ fn parse_commit_keyword<'a>(repo: RepoRef<'a>, pair: Pair<Rule>) -> (Property<'a
"author" => Property::Signature(Box::new(AuthorProperty)),
"committer" => Property::Signature(Box::new(CommitterProperty)),
"open" => Property::Boolean(Box::new(OpenProperty)),
"abandoned" => Property::Boolean(Box::new(PrunedProperty)),
"current_checkout" => Property::Boolean(Box::new(CurrentCheckoutProperty { repo })),
"branches" => Property::String(Box::new(BranchProperty { repo })),
"tags" => Property::String(Box::new(TagProperty { repo })),
"git_refs" => Property::String(Box::new(GitRefsProperty { repo })),
"obsolete" => Property::Boolean(Box::new(ObsoleteProperty { repo })),
"orphan" => Property::Boolean(Box::new(OrphanProperty { repo })),
"divergent" => Property::Boolean(Box::new(DivergentProperty { repo })),
"conflict" => Property::Boolean(Box::new(ConflictProperty)),
name => panic!("unexpected identifier: {}", name),

View File

@ -202,14 +202,6 @@ impl<'r> TemplateProperty<Commit, bool> for OpenProperty {
}
}
pub struct PrunedProperty;
impl TemplateProperty<Commit, bool> for PrunedProperty {
fn extract(&self, context: &Commit) -> bool {
context.is_pruned()
}
}
pub struct CurrentCheckoutProperty<'a> {
pub repo: RepoRef<'a>,
}
@ -294,26 +286,6 @@ impl TemplateProperty<Commit, String> for GitRefsProperty<'_> {
}
}
pub struct ObsoleteProperty<'a> {
pub repo: RepoRef<'a>,
}
impl TemplateProperty<Commit, bool> for ObsoleteProperty<'_> {
fn extract(&self, context: &Commit) -> bool {
self.repo.evolution().is_obsolete(context.id())
}
}
pub struct OrphanProperty<'a> {
pub repo: RepoRef<'a>,
}
impl TemplateProperty<Commit, bool> for OrphanProperty<'_> {
fn extract(&self, context: &Commit) -> bool {
self.repo.evolution().is_orphan(context.id())
}
}
pub struct DivergentProperty<'a> {
pub repo: RepoRef<'a>,
}