mercurial/templates/map-cmdline.show
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 24 Jun 2017 12:47:25 -0700
changeset 33046 11f768258dcc
parent 32059 0ea1d9a750da
child 33050 0a507da7d8ea
permissions -rw-r--r--
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.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32059
0ea1d9a750da show: add basic labels to work template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32058
diff changeset
     1
# TODO there are a few deficiencies in this file:
0ea1d9a750da show: add basic labels to work template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32058
diff changeset
     2
# * The "namespace" of the labels needs to be worked out. We currently
0ea1d9a750da show: add basic labels to work template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32058
diff changeset
     3
#   piggyback on existing values so color works.
0ea1d9a750da show: add basic labels to work template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32058
diff changeset
     4
# * Obsolescence isn't considered for node labels. See _cset_labels in
0ea1d9a750da show: add basic labels to work template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32058
diff changeset
     5
#   map-cmdline.default.
31765
264baeef3588 show: new extension for displaying various repository data
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
showbookmarks = '{if(active, "*", " ")} {pad(bookmark, longestbookmarklen + 4)}{shortest(node, 5)}\n'
33046
11f768258dcc show: construct changeset templater during dispatch
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32059
diff changeset
     7
11f768258dcc show: construct changeset templater during dispatch
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32059
diff changeset
     8
showwork = '{cset_shortnode}{cset_names} {cset_shortdesc}'
11f768258dcc show: construct changeset templater during dispatch
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32059
diff changeset
     9
11f768258dcc show: construct changeset templater during dispatch
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32059
diff changeset
    10
cset_shortnode = '{label("log.changeset changeset.{phase}", shortest(node, 5))}'
11f768258dcc show: construct changeset templater during dispatch
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32059
diff changeset
    11
cset_names = '{if(branches, " ({label("log.branch", branch)})")}{if(bookmarks, " ({label("log.bookmarks", bookmarks)})")}'
11f768258dcc show: construct changeset templater during dispatch
Gregory Szorc <gregory.szorc@gmail.com>
parents: 32059
diff changeset
    12
cset_shortdesc = '{label("log.description", desc|firstline)}'