[PATCH] hgweb: allow web.templates to be a list

Anton Shestakov engored at ya.ru
Sun Jul 10 09:24:06 EDT 2016


10.07.2016, 02:26, "Ross Light via Mercurial-devel" <mercurial-devel at mercurial-scm.org>:
> # HG changeset patch
> # User Ross Light <light at google.com>
> # Date 1468018129 25200
> # Fri Jul 08 15:48:49 2016 -0700
> # Node ID 0611009f75ac6e0c661207927ed9606b83b56d28
> # Parent b4d117cee636be8a566f56e84d4b351a736a1299
> hgweb: allow web.templates to be a list
>
> templater already supports searching multiple directories, but the config value
> was read in as one string. This allows the web.templates setting to use this
> functionality.
>
> diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
> --- a/mercurial/help/config.txt
> +++ b/mercurial/help/config.txt
> @@ -2093,8 +2093,8 @@
>      Example: ``monoblue``.
>
>  ``templates``
> - Where to find the HTML templates. The default path to the HTML templates
> - can be obtained from ``hg debuginstall``.
> + List of directories to search for the HTML templates. The default path
> + to the HTML templates can be obtained from ``hg debuginstall``.
>
>  ``websub``
>  ----------
> diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
> --- a/mercurial/hgweb/hgweb_mod.py
> +++ b/mercurial/hgweb/hgweb_mod.py
> @@ -99,7 +99,7 @@
>          # we use untrusted=False to prevent a repo owner from using
>          # web.templates in .hg/hgrc to get access to any file readable
>          # by the user running the CGI script
> - self.templatepath = self.config('web', 'templates', untrusted=False)
> + self.templatepath = self.configlist('web', 'templates',
> untrusted=False)

It's hard to believe how many tests this broke.

Also the patch seems to be line-wrapped on 80 symbols, which means it fails to import cleanly. It may be your MUA doing this, in which case try a different one or set up patchbomb extension (I certainly know my current MUA does silly things to whitespace as you can see above, sorry about that).

And seems like the line above will go over 79 characters in length, which means it now doesn't conform to our coding style.

Please refer to 9 and 10 in the submission checklist on https://www.mercurial-scm.org/wiki/ContributingChanges


More information about the Mercurial-devel mailing list