Mercurial > hg
changeset 45322:c3376a724e32
templater: teach template loader to use open_template() function
The template loader can apparently load templates from relative paths,
so I needed to add that support to `open_template()`.
This takes the number of failing tests with PyOxidizer from 54 to 34.
Differential Revision: https://phab.mercurial-scm.org/D8907
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 06 Aug 2020 10:53:00 -0700 |
parents | 735756ecda8c |
children | aea6a812f7cb |
files | mercurial/templater.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templater.py Thu Aug 06 10:52:52 2020 -0700 +++ b/mercurial/templater.py Thu Aug 06 10:53:00 2020 -0700 @@ -913,7 +913,8 @@ """Get parsed tree for the given template name. Use a local cache.""" if t not in self.cache: try: - self.cache[t] = util.readfile(self._map[t]) + mapfile, fp = open_template(self._map[t]) + self.cache[t] = fp.read() except KeyError as inst: raise templateutil.TemplateNotFound( _(b'"%s" not in template map') % inst.args[0] @@ -1092,7 +1093,7 @@ will then be the relative path. ''' # Does the name point directly to a map file? - if os.path.isabs(name): + if os.path.isfile(name) or os.path.isabs(name): return name, open(name, mode='rb') # Does the name point to a template in the provided templatepath, or