[PATCH 01 of 11 V2] scmutil: add a method to convert environment variables to config items

Yuya Nishihara yuya at tcha.org
Sat Mar 25 00:16:12 EDT 2017


On Wed, 22 Mar 2017 08:52:32 -0700, Jun Wu wrote:
> Excerpts from Ryan McElroy's message of 2017-03-22 11:16:40 +0000:
> > This function is fine, but scmutil feels like the wrong place for it. 
> > Why is it not in config.py?
> > 
> > This same question applies to patches 2-5 as well. I seems like most of 
> > this should be living in config.py.
> > 
> > We can move it over in a future series, I suppose?
> 
> Two reasons:
> 
>   1. The existing *path() functions are in scmposix, scmwindows and scmutil
>   2. If you look at config.py, it has zero special-case logic. i.e. it does
>      not know config sections, it does not know config paths, etc. It only
>      knows how to load configs and provides a class to access configs.
> 
> I think config.py is better keeping "pure" by providing just the data
> strucutre without any knowledge about actual config sections etc.
> 
> In the upcoming immutable config series, the config.py will have immutable
> structures. But things like ui.fixconfig, ui.readconfig, trust vs untrust
> etc will stay away from config.py

Maybe we can introduce rcutil.py (or hgrcutil.py) and move scmutil.*rcpath(),
ui.samplehgrcs, and ui.pathsuboption stuffs into it.


More information about the Mercurial-devel mailing list