This is similar to edbcf5b239f9 (config: read configs from directories
in lexicographical order, 2019-04-03). Apparently I forgot to sort the
system hgrc files there. That's fixed by this patch.
Details
- Reviewers
Alphare mharbison72 - Group Reviewers
hg-reviewers - Commits
- rHG9ac96b9fa76e: config: read system hgrc in lexicographical order
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
Event Timeline
I like the idea of a stable order, but I think this is a BC. Specifically, hg help config.files says:
The names of these files depend on the system on which Mercurial is installed. "*.rc" files from a single directory are read in alphabetical order, later ones overriding earlier ones. Where multiple paths are given below, settings from earlier paths override later ones. On Windows, the following files are consulted: - "<repo>/.hg/hgrc" (per-repository) - "%USERPROFILE%\.hgrc" (per-user) - "%USERPROFILE%\Mercurial.ini" (per-user) - "%HOME%\.hgrc" (per-user) - "%HOME%\Mercurial.ini" (per-user) - "HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial" (per-system) - "<install-dir>\hgrc.d\*.rc" (per-installation) - "<install-dir>\Mercurial.ini" (per-installation) - "%PROGRAMDATA%\Mercurial\hgrc" (per-system) - "%PROGRAMDATA%\Mercurial\Mercurial.ini" (per-system) - "%PROGRAMDATA%\Mercurial\hgrc.d\*.rc" (per-system) - "<internal>/*.rc" (defaults)
I read that as %USERPROFILE%\.hgrc overrides %USERPROFILE%\Mercurial.ini, but .hgrc will sort first.
There's also a bit of ordering of the list in mercurial.scmwindows.systemrcpath(). So maybe the sorting needs to happen inside the platform functions, and only when scanning a directory?
Ohh, good catch! I'll move the sorting into the platform functions as you suggested. Thanks!
Queued, thanks.
mercurial/scmwindows.py | ||
---|---|---|
34 | Not related to this patch, but I'm surprised that we don't care to ignore directories here (and in posix), and just key off of the name. IDK what happens when a directory instead of a file is tossed into the config list. rcutil._expandrcpath() similarly doesn't check. |
mercurial/scmwindows.py | ||
---|---|---|
34 | Based on some manual testing I just did, it simply ignores paths that are directories. I haven't checked where in the code that happens. |
Not related to this patch, but I'm surprised that we don't care to ignore directories here (and in posix), and just key off of the name. IDK what happens when a directory instead of a file is tossed into the config list. rcutil._expandrcpath() similarly doesn't check.