[Bug 4832] New: hgrc file format should support an !important qualifier like CSS

Brandon McCaig bamccaig at gmail.com
Mon Sep 21 23:11:24 CDT 2015


On Thu, Sep 17, 2015 at 7:49 AM,  <mercurial-bugs at selenic.com> wrote:
> Today I encountered a Linux machine that wouldn't access our internal
> repositories through https despite having web.cacerts set to the correct
> certificate store (including our internal-use CA certificates) in
> /usr/local/etc/mercurial/hgrc. It turned out that /etc/mercurial/hgrc.d
> contained an rc file that also tried to set web.cacerts, to a different
> certificate store.
>
> Debugging this was a rather difficult affair, took me a while to find the file
> that contained the bogus web.cacerts setting. Even worse, it could have been a
> file to which I have no write access.
>
> For this reason, it would be nice to have an !important qualifier like CSS, to
> allow settings in one file to forcibly override ones even in higher-priority
> files.

AFAIK, repository configs override user configs override system
configs. There is already a meaningful hierarchy there that gives the
correct agent control: the user. Something like "!important" would
just muddy the waters further instead of making things better.
Suddenly a system admin could have users wondering why their configs
aren't working? No, no, no. I'm not even sure it has a real use in
CSS. The real problem was your difficulty debugging this, and if
there's an improvement to be made then I would argue it is there. For
example, hg showconfig should have an option to list where the
authoritative setting is coming from so that you can debug and/or
override that (or just fix the wrong setting at the source).

You should never have a need to override a nested setting (albeit, in
the case of /etc/mercurial/hgrc and /etc/mercurial/.hgrc.d/*.rc
perhaps the definition could be more explicit or better defined; from
the documentation they all sound equal which might lead to some
confusion; I would assume a usual alphanumeric sort order).

The documentation is probably a weak point, and better diagnostics to
lead you to the culprit probably make better sense than something like
!important. It sounds like Git supports command-line options to
disable the use of user and repository configuration files. Perhaps
that would be useful for something like scripting, but I don't imagine
it would often be useful for interactive sessions.

Thoughts?

Regards,


-- 
Brandon McCaig <bamccaig at gmail.com> <bamccaig at castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bambams.ca/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'


More information about the Mercurial-devel mailing list