Martin von Zweigbergk <martinvonz@google.com> [Tue, 04 Aug 2020 13:22:00 -0700] rev 45331
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
Martin von Zweigbergk <martinvonz@google.com> [Tue, 04 Aug 2020 13:21:29 -0700] rev 45330
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
Martin von Zweigbergk <martinvonz@google.com> [Thu, 30 Jul 2020 13:44:06 -0700] rev 45329
templater: start passing resource to read from into _readmapfile()
This patch makes it so we pass in a file-like resource to read from
instead of having `_readmapfile()` open the file. This is one more
step towards making `_readmapfile()` able to read resources opened by
from `importlib.resources`. We still need to pass in the mapfile path
because it's used for loading dependent mapfiles from `%include` and
`__base__`, and it's also used for giving the user better error
messages. Besides that, one can safely call `_readmapfile()` with any
file-like resource after this patch.
Differential Revision: https://phab.mercurial-scm.org/D8891
Martin von Zweigbergk <martinvonz@google.com> [Tue, 04 Aug 2020 09:13:10 -0700] rev 45328
templater: move stylemap() to hgweb_mod, since that's its only user
`stylemap()` even has an error message that mentions "hgweb
templates", so it seems that it's meant specifically for hgweb.
Differential Revision: https://phab.mercurial-scm.org/D8890
Martin von Zweigbergk <martinvonz@google.com> [Mon, 03 Aug 2020 22:15:45 -0700] rev 45327
hgweb: simplify staticfile() now that we always pass it a single directory
I didn't realize this further simplifications enabled by D8786 until
now.
Differential Revision: https://phab.mercurial-scm.org/D8874
Martin von Zweigbergk <martinvonz@google.com> [Fri, 31 Jul 2020 10:05:07 -0700] rev 45326
packaging: include templates with their package as key in package_data
This is similar to an earlier patch in this series. It seems more
correct to use `mercurial.templates.coal` etc as keys in the
`package_data` dict now that those modules are packages.
Differential Revision: https://phab.mercurial-scm.org/D8858
Martin von Zweigbergk <martinvonz@google.com> [Fri, 31 Jul 2020 09:49:52 -0700] rev 45325
packaging: mark mercurial.templates and subdirs as packages
We need these packages to be installed so PyOxidizer picks them up.
Differential Revision: https://phab.mercurial-scm.org/D8855
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Dec 2019 12:41:01 -0800] rev 45324
templates: add __init__.py files to templates/ dirs
This is necessary for them to be loaded with `importlib.resources`,
which we want to do for PyOxidizer and similar. `importlib.resources`
cannot read resources from submodules
(`resources.open_binary('mercurial.templates', 'coal/map')` is not
valid), so we need one `__init__.py` per directory.
Differential Revision: https://phab.mercurial-scm.org/D8854
Augie Fackler <augie@google.com> [Wed, 05 Aug 2020 13:36:50 -0400] rev 45323
merge with stable
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 21 Jul 2020 18:21:27 +0530] rev 45322
localrepo: abort creating a shared repo if the source does not have store
We cannot create a shared repository without a store IIUC. Let's abort in such
cases.
Differential Revision: https://phab.mercurial-scm.org/D8772