templater: switch to lower-level config.parse() in _readmapfile()
I hope to modify this code to also work with resources loaded from
memory (for PyOxidizer support). For that, we'll need to handle the
lookup of relative `%include` path (not joined with the base directory
of the containing file). This patch prepares for that by using
`config.parse()` instead of `config.read()`, since the latter expects
a file in the file system.
As it happens, this change also lets us clean up the `config` class to
not need the `_includepaths` field. That will happen next.
Differential Revision: https://phab.mercurial-scm.org/D8791
config: pass both relative and absolute paths to `include` callback
The `include` callback is responsible for loading configs from
`%include` statements. The callback currently gets passed the absolute
path [1] to the config to read. That is created by joining the dirname
of the file that contains the `%include` statement. For PyOxidizer
support, I'm trying to reduce dependence on paths. This patch helps
with that by passing the relative path found in the `%include`
statement (but with username expansion, etc.) to the `include`
callback. It also turns out that the existing callers can easily adapt
to using the relative path. Coming patches will clean that up and then
we'll remove the absolute path from the callback.
[1] The "absolute path" bit is a bit of a lie -- it's going to be an
absolute path if the path that was passed into `config.parse()` was
absolute.
Differential Revision: https://phab.mercurial-scm.org/D8790
tests: add test for bad template %include and __base__
It doesn't seem like we had any tests for `%include non-existent` and
`__base__ = non-existent`. The latter raises an error while the former
ignores the include. We should probably also make the former an error.
Differential Revision: https://phab.mercurial-scm.org/D8798
tests: add test for unqualified include of a built-in template map
The feature was added in
081b08e4ea13 (templater: look for mapfiles in
template paths, 2015-05-15), but no test case was added.
Differential Revision: https://phab.mercurial-scm.org/D8797