This untrusted configparser is a superset of the trusted configparser,
so that interpolation still works.
Also add an "untrusted" argument to ui.config* to allow querying
ui.ucdata.
With --debug, we print a warning when we read an untrusted config
file, and when we try to access a trusted setting that has one value
in the trusted configparser and another in the untrusted configparser.
The list of trusted users and groups is specified in the [trusted]
section of a hgrc; the current user is always trusted; "*" can be
used to trust all users/groups.
Global hgrc files are always read.
On Windows (and other systems that don't have the pwd and grp modules),
all .hg/hgrc files are read.
This is essentially the same patch that was previously applied as
revision f077d29b114d.
This change has the potential to break existing setups, but the current
behaviour (the keys in configuration files are always lower-cased) can
bite us in a few places:
- no way to use a Command in [defaults]
- hgext.Extension doesn't work in [extensions]
- you can't use an Upper/case/PATH in the [paths] section of hgweb.config
- you can't (easily) protect paths with upper-case letters with the
acl extension
- you can't specify a /Path/TO/a/rEPO in the [reposubs] section for
the notify extension
- ui.quiet/verbose/debug/interactive become just a cache of the ui.cdata
settings
- the quiet, verbose, debug and interactive options from the [ui] section
from .hg/hgrc files are respected for commands that open the repo
- setting ui.quiet/verbose/debug/interactive with --config works
- the command line options always override the hgrc settings - previously
it wasn't possible to override a [ui] debug = True. --debug still
takes precedence over --quiet and --verbose.
The code in ui.updateopts that handles ui.quiet, ui.verbose and
ui.debugflag is too smart, making it somewhat hard to see what
are the exact constraints placed on the values of these variables,
hiding some buglets.
This patch makes these constraints more explicit, fixing these
buglets and changing the behaviour slightly. It also adds a test
to make sure things work as expected in the future.
The buglets:
- setting ui.debug = True in a hgrc wouldn't turn on verbose mode
- additionally, setting ui.quiet = True or using --quiet would give
you a "quiet debug" mode.
The behaviour change:
- previously, in a hgrc file, ui.quiet wins against ui.verbose (i.e.
the final result would be quiet mode), but --verbose wins against
--quiet
- now ui.quiet nullifies ui.verbose and --verbose nullifies --quiet.
As a consequence, using -qv always gives you normal mode (unless
debug mode was turned on somewhere)
Previously, we would normalize settings (e.g. turn relative paths into
absolute ones) only after reading a config file.
Now "--config paths.foo=bar" will use the cwd to make "bar" an absolute
path.