obshistory: restructure templates a bit, drop default verb ("pruned")
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 18 Mar 2020 19:20:17 +0700
changeset 5307 66a913cc53af
parent 5306 1e2f3fa129f2
child 5308 0329246c70f3
obshistory: restructure templates a bit, drop default verb ("pruned") We always have a verb provided to the templates now, this should be fine.
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/obshistory.py	Mon Mar 16 19:13:33 2020 +0700
+++ b/hgext3rd/evolve/obshistory.py	Wed Mar 18 19:20:17 2020 +0700
@@ -108,12 +108,11 @@
     b"presentnode": TEMPLATE_PRESENT_NODE,
     b"missingnode": TEMPLATE_MISSING_NODE
 }
-TEMPLATE_VERB = b"""{label("evolve.verb", verb)}"""
 TEMPLATE_SUCCNODES = b"""{label("evolve.node", join(succnodes % "{succnode|short}", ", "))}"""
-TEMPLATE_REWRITE = b"""{if(succnodes, "%(verb)s{if(effects, "({join(effects, ", ")})")} as %(succnodes)s", "pruned")}""" % {
-    b"verb": TEMPLATE_VERB,
+TEMPLATE_NODES = b"""{if(succnodes, "as %(succnodes)s")}""" % {
     b"succnodes": TEMPLATE_SUCCNODES
 }
+TEMPLATE_REWRITE = b"""{label("evolve.verb", verb)}{if(effects, "({join(effects, ", ")})")}"""
 TEMPLATE_OPERATIONS = b"""{if(operations, "using {label("evolve.operation", join(operations, ", "))}")}"""
 TEMPLATE_USERS = b"""by {label("evolve.user", join(users, ", "))}"""
 TEMPLATE_ONE_DATE = b"""({date(max(dates), "%a %b %d %H:%M:%S %Y %1%2")})"""
@@ -125,10 +124,11 @@
 TEMPLATE_NOTES = b"""{if(notes, notes % "\n    note: {label("evolve.note", note)}")}"""
 TEMPLATE_PATCH = b"""{if(patch, "{patch}")}{if(nopatchreason, "\n(No patch available, {nopatchreason})")}"""
 DEFAULT_TEMPLATE = (b"""%(firstline)s
-{markers %% "  {separate(" ", "%(rewrite)s", "%(operations)s", "%(users)s", "%(dates)s")}%(notes)s{indent(descdiff, "    ")}{indent("%(patch)s", "    ")}\n"}
+{markers %% "  {separate(" ", "%(rewrite)s", "%(nodes)s", "%(operations)s", "%(users)s", "%(dates)s")}%(notes)s{indent(descdiff, "    ")}{indent("%(patch)s", "    ")}\n"}
 """) % {
     b"firstline": TEMPLATE_FIRST_LINE,
     b"rewrite": TEMPLATE_REWRITE,
+    b"nodes": TEMPLATE_NODES,
     b"operations": TEMPLATE_OPERATIONS,
     b"users": TEMPLATE_USERS,
     b"dates": TEMPLATE_DATES,