Skip to content
Snippets Groups Projects
  1. May 06, 2016
  2. Apr 04, 2016
    • Yuya Nishihara's avatar
      bugzilla: do not load style file if template is specified (BC) · 9e1c9f016b72
      Yuya Nishihara authored
      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.
      9e1c9f016b72
Loading