Mercurial > hg
diff mercurial/templater.py @ 45310:f3481e4fcc3a
templater: pass opened file-like object to templatespec
I think I said earlier that I planned to create a special templatespec
variant for built-in templates. That was true (I planned that), but I
ended up (in this patch) just adding a file-like object to the
`mapfile_templatespec()` variant instead.
Differential Revision: https://phab.mercurial-scm.org/D8893
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 04 Aug 2020 13:22:00 -0700 |
parents | 65a812ed9e9f |
children | 3b27ed8e324e |
line wrap: on
line diff
--- a/mercurial/templater.py Tue Aug 04 13:21:29 2020 -0700 +++ b/mercurial/templater.py Tue Aug 04 13:22:00 2020 -0700 @@ -994,6 +994,7 @@ def frommapfile( cls, mapfile, + fp=None, filters=None, defaults=None, resources=None, @@ -1003,7 +1004,8 @@ ): """Create templater from the specified map file""" t = cls(filters, defaults, resources, cache, [], minchunk, maxchunk) - fp = _open_mapfile(mapfile) + if not fp: + fp = _open_mapfile(mapfile) cache, tmap, aliases = _readmapfile(fp, mapfile) t._loader.cache.update(cache) t._loader._map = tmap