Mercurial > public > mercurial-scm > hg-stable
diff mercurial/formatter.py @ 45330:65a812ed9e9f
templater: replace templatepath() with function that also opens the file
For frozen binaries, such as those created by PyOxidizer, I plan to
make it so the templatespec can keep an opened file/resource to read
from instead of needing a file path. Having `templatepath()` return an
opened file should help with that. At this point, it's just a wasteful
extra opening of mapfiles that we'll open again later. I'll update the
read-side next so it reads from the file-like object without opening
the file again.
Differential Revision: https://phab.mercurial-scm.org/D8892
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 04 Aug 2020 13:21:29 -0700 |
parents | 215f08c8006c |
children | f3481e4fcc3a |
line wrap: on
line diff
--- a/mercurial/formatter.py Thu Jul 30 13:44:06 2020 -0700 +++ b/mercurial/formatter.py Tue Aug 04 13:21:29 2020 -0700 @@ -599,9 +599,9 @@ # perhaps a stock style? if not os.path.split(tmpl)[0]: - mapname = templater.templatepath( + (mapname, fp) = templater.open_template( b'map-cmdline.' + tmpl - ) or templater.templatepath(tmpl) + ) or templater.open_template(tmpl) if mapname: return mapfile_templatespec(topic, mapname)