view mercurial/templates/map-cmdline.show @ 33046:11f768258dcc

show: construct changeset templater during dispatch Previously, we constructed a formatter from a specific template topic. Then from show() we reached into the internals of the formatter to resolve a template string to be used to construct a changeset templater. A downside to this approach was it limited us to having the entire template defined in a single entry in the map file. You couldn't reference other entries in the map file and this would lead to long templates and redundancy in the map file. This commit teaches @showview how to instantiate a changeset templater so we can construct a templater with full access to the map file. To prove it works, we've split "showwork" into components.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 24 Jun 2017 12:47:25 -0700
parents 0ea1d9a750da
children 0a507da7d8ea
line wrap: on
line source

# TODO there are a few deficiencies in this file:
# * The "namespace" of the labels needs to be worked out. We currently
#   piggyback on existing values so color works.
# * Obsolescence isn't considered for node labels. See _cset_labels in
#   map-cmdline.default.
showbookmarks = '{if(active, "*", " ")} {pad(bookmark, longestbookmarklen + 4)}{shortest(node, 5)}\n'

showwork = '{cset_shortnode}{cset_names} {cset_shortdesc}'

cset_shortnode = '{label("log.changeset changeset.{phase}", shortest(node, 5))}'
cset_names = '{if(branches, " ({label("log.branch", branch)})")}{if(bookmarks, " ({label("log.bookmarks", bookmarks)})")}'
cset_shortdesc = '{label("log.description", desc|firstline)}'