[Updated] D8907: templater: teach template loader to use open_template() function
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Aug 7 00:34:26 UTC 2020
Closed by commit rHGc3376a724e32: templater: teach template loader to use open_template() function (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8907?vs=22317&id=22321
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8907/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8907
AFFECTED FILES
mercurial/templater.py
CHANGE DETAILS
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -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
To: martinvonz, #hg-reviewers, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200807/189539b1/attachment-0002.html>
More information about the Mercurial-patches
mailing list