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

Jun Wu quark at fb.com
Wed Mar 22 11:52:32 EDT 2017


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


More information about the Mercurial-devel mailing list