From a750be2b9be9c3313284b4e89b69f0d78f25ecae Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 6 Oct 2021 22:29:14 -0700 Subject: [PATCH] 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. --- src/commands.rs | 8 +------- src/template_parser.rs | 7 ++----- src/templater.rs | 28 ---------------------------- 3 files changed, 3 insertions(+), 40 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 26c7cf1a9..188e561fa 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -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" diff --git a/src/template_parser.rs b/src/template_parser.rs index 179fc2978..3cf5959db 100644 --- a/src/template_parser.rs +++ b/src/template_parser.rs @@ -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) -> (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), diff --git a/src/templater.rs b/src/templater.rs index 8e54920f7..c5203f0c6 100644 --- a/src/templater.rs +++ b/src/templater.rs @@ -202,14 +202,6 @@ impl<'r> TemplateProperty for OpenProperty { } } -pub struct PrunedProperty; - -impl TemplateProperty 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 for GitRefsProperty<'_> { } } -pub struct ObsoleteProperty<'a> { - pub repo: RepoRef<'a>, -} - -impl TemplateProperty 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 for OrphanProperty<'_> { - fn extract(&self, context: &Commit) -> bool { - self.repo.evolution().is_orphan(context.id()) - } -} - pub struct DivergentProperty<'a> { pub repo: RepoRef<'a>, }