Matt Harbison <matt_harbison@yahoo.com> [Sun, 29 Dec 2019 21:06:34 -0500] rev 44031
ui: add the ability to apply `defaultrc` configs from resources
We will want the ability to cat out these resources, but the same would apply to
templates, so I'm going to wait for the dust to settle on that. Reading the
default config directly from the filesystem is still in place for now.
Differential Revision: https://phab.mercurial-scm.org/D7776
Matt Harbison <matt_harbison@yahoo.com> [Sun, 29 Dec 2019 20:51:44 -0500] rev 44030
ui: refactor `readconfig()` into a form that can consume resources
The old form can't completely go away, because files outside of packages still
need to be read. The name passed in here is a tuple of `package name, resource`
as needed by the resource API.
I like the idea of stating the config file is embedded in the executable by
listing is as `exe!package.resource`. This would be consistent with how
`debuginstall` points to the executable for the python executable, lib, and
installed modules. While in practice the filesystem path is available from the
backing ResourceReader when the resource is opened, it is a relative path on py2
and absolute on py3. Further, while this would show in the `hg config` output
for each option if set as such here, it doesn't show in the `reading from...`
line when `--debug` is used. The file isn't actually open where that prints, so
there's no way I see to get that info there. So I opted for the simple prefix
to distinguish resources from files.
Differential Revision: https://phab.mercurial-scm.org/D7775
Matt Harbison <matt_harbison@yahoo.com> [Sun, 29 Dec 2019 20:35:34 -0500] rev 44029
resourceutil: implement `contents()` to iterate over resources in a package
Differential Revision: https://phab.mercurial-scm.org/D7774
Matt Harbison <matt_harbison@yahoo.com> [Sun, 29 Dec 2019 20:32:56 -0500] rev 44028
resourceutil: implement `is_resource()`
This will be needed when iterating resources.
Differential Revision: https://phab.mercurial-scm.org/D7773
Matt Harbison <matt_harbison@yahoo.com> [Sat, 28 Dec 2019 23:35:13 -0500] rev 44027
resourceutil: don't limit resources to the `mercurial` package
This should make things a little clearer, in that it now requires the full
package name to access a resource. But the real motivation is that
`extensions._disabledpaths()` walks the `hgext` directory looking for bundled
extensions. This in turn feeds, among other things:
1) Listing disabled extensions in `hg help extensions`
2) Indicating that an unknown command is in a non-enabled extension
3) Displaying help for non-enabled extensions
4) Generating documentation
5) Announcing LFS is auto-enabled (or not) when cloning from an LFS source
The filesystem based ResourceReader will happily return *.py and *.pyc, but the
one supplied by PyOxidizer doesn't. Presumably we can change that. The only
other idea I had here is for setup.py to generate a text file containing the
list of extensions, but that doesn't seem great when running from source.
Differential Revision: https://phab.mercurial-scm.org/D7772
Matt Harbison <matt_harbison@yahoo.com> [Sat, 28 Dec 2019 23:08:57 -0500] rev 44026
setup: include `defaultrc` in the package list
This is needed to access the config files via the resourceutil framework, which
is needed to embed the config files when uing PyOxidizer.
Differential Revision: https://phab.mercurial-scm.org/D7771