Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 31679:0f8ba0bc1154
rcutil: move scmutil.*rcpath to rcutil (API)
As discussed at [1], the logic around "actual config"s seem to be
non-trivial enough that it's worth a new module.
This patch creates the module and move "scmutil.*rcpath" functions there as
the first step. More methods will be moved to the module in the future.
The module is different from config.py because the latter only cares about
data structure and parsing, and does not care about special case, or system
config paths, or environment variables.
[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095503.html
author | Jun Wu <quark@fb.com> |
---|---|
date | Sun, 26 Mar 2017 20:18:42 -0700 |
parents | c60091fa1426 |
children | 07d62fa518a4 |
comparison
equal
deleted
inserted
replaced
31678:1ed57a7dd904 | 31679:0f8ba0bc1154 |
---|---|
31 encoding, | 31 encoding, |
32 error, | 32 error, |
33 formatter, | 33 formatter, |
34 progress, | 34 progress, |
35 pycompat, | 35 pycompat, |
36 rcutil, | |
36 scmutil, | 37 scmutil, |
37 util, | 38 util, |
38 ) | 39 ) |
39 | 40 |
40 urlreq = util.urlreq | 41 urlreq = util.urlreq |
209 @classmethod | 210 @classmethod |
210 def load(cls): | 211 def load(cls): |
211 """Create a ui and load global and user configs""" | 212 """Create a ui and load global and user configs""" |
212 u = cls() | 213 u = cls() |
213 # we always trust global config files | 214 # we always trust global config files |
214 for f in scmutil.rcpath(): | 215 for f in rcutil.rcpath(): |
215 u.readconfig(f, trust=True) | 216 u.readconfig(f, trust=True) |
216 return u | 217 return u |
217 | 218 |
218 def copy(self): | 219 def copy(self): |
219 return self.__class__(self) | 220 return self.__class__(self) |