Mercurial > hg
view tests/test-batching.py.out @ 28950:9e1c9f016b72
bugzilla: do not load style file if template is specified (BC)
This prepares for the API change to support template aliases. I'm going to
extract a factory function of templater that reads a map file:
# original
templater(mapfile, ..., cache, ...)
# new
templater.frommapfile(mapfile, ...) # read mapfile to build cache/map
templater(..., cache, ...) # use specified cache (= map elements)
This will make it clear to isolate stock styles (i.e. map files) from user
aliases. Template aliases should be applied to command arguments and templates
in hgrc, but not to map files. Otherwise, our stock styles and web templates
could be modified unintentionally.
This patch makes sure that either "tmpl" or "mapfile" is exclusively set. It's
theoretically a behavior change, since you could put new keywords in template
by defining them in a map file before:
# mapfile
foo = "{rev}"
# hgrc
[bugzilla]
style = mapfile
template = {foo}
But the old behavior would be a bug because bugzilla.template is documented
as "overrides style if specified". Also, common log-like templates and
formatter doesn't allow using mapfile-keywords in a separate template. So
I decided to make a BC.
Since there was no test for the bugzilla extension, this adds new test that
covers style/template output.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 04 Apr 2016 22:48:34 +0900 |
parents | 84094c0d2724 |
children | e2fc2122029c |
line wrap: on
line source
== Local Ready. Un and Deux Eins und Zwei One and Two Nope Eins und Zwei Hello, John Smith Ready. Uno und Due == Remote Ready. REQ: foo?one=Vo&two=Efvy -> Vo!boe!Efvy Un and Deux REQ: bar?b=Fjot&a=[xfj -> Fjot!voe![xfj Eins und Zwei REQ: batch?cmds=foo:one=Pof,two=Uxp;bar:b=Fjot,a=[xfj -> Pof!boe!Uxp;Fjot!voe![xfj REQ: greet?name=Kpio!Tnjui -> Ifmmp-!Kpio!Tnjui REQ: batch?cmds=bar:b=Vop,a=Evf -> Vop!voe!Evf One and Two Nope Eins und Zwei Hello, John Smith Ready. Uno und Due