Mercurial > public > mercurial-scm > hg
comparison mercurial/scmwindows.py @ 26625:adae8928fe09
windows: read all global config files, not just the first (issue4491) (BC)
On windows, hgrc.d/*.rc would not be read if mercurial.ini was found. That was
far from obvious from the documentation and different from the behavior on
posix systems.
As a consequence of this, TortoiseHg cacert configuration placed in hgrc.d
would not be read if an old global mercurial.ini still existed.
"hg config -g" could also crash when no global configuration files could be
found.
Instead, make windows behave like posix and read all global configuration
files.
The documentation was in a way right that individual config settings in the
global Mercurial.ini would override settings from for example .hgrc.d\*.rc, but
only because the .d files not would be read at all if a Mercurial.ini was
found. The ordering in the documentation is thus changed to match the code.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 12 Oct 2015 20:13:12 +0200 |
parents | 23c995ed466b |
children | 029f02757c20 |
comparison
equal
deleted
inserted
replaced
26624:bcace0fbb4c8 | 26625:adae8928fe09 |
---|---|
7 '''return default os-specific hgrc search path''' | 7 '''return default os-specific hgrc search path''' |
8 rcpath = [] | 8 rcpath = [] |
9 filename = util.executablepath() | 9 filename = util.executablepath() |
10 # Use mercurial.ini found in directory with hg.exe | 10 # Use mercurial.ini found in directory with hg.exe |
11 progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini') | 11 progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini') |
12 if os.path.isfile(progrc): | 12 rcpath.append(progrc) |
13 rcpath.append(progrc) | |
14 return rcpath | |
15 # Use hgrc.d found in directory with hg.exe | 13 # Use hgrc.d found in directory with hg.exe |
16 progrcd = os.path.join(os.path.dirname(filename), 'hgrc.d') | 14 progrcd = os.path.join(os.path.dirname(filename), 'hgrc.d') |
17 if os.path.isdir(progrcd): | 15 if os.path.isdir(progrcd): |
18 for f, kind in osutil.listdir(progrcd): | 16 for f, kind in osutil.listdir(progrcd): |
19 if f.endswith('.rc'): | 17 if f.endswith('.rc'): |
20 rcpath.append(os.path.join(progrcd, f)) | 18 rcpath.append(os.path.join(progrcd, f)) |
21 return rcpath | |
22 # else look for a system rcpath in the registry | 19 # else look for a system rcpath in the registry |
23 value = util.lookupreg('SOFTWARE\\Mercurial', None, | 20 value = util.lookupreg('SOFTWARE\\Mercurial', None, |
24 _winreg.HKEY_LOCAL_MACHINE) | 21 _winreg.HKEY_LOCAL_MACHINE) |
25 if not isinstance(value, str) or not value: | 22 if not isinstance(value, str) or not value: |
26 return rcpath | 23 return rcpath |