Mercurial > hg-stable
comparison mercurial/scmwindows.py @ 43956:1ccf340acf14
windows: add a global equivalent to /etc/mercurial for *.rc processing
This follows the Unix model of processing this directory immediately after
<internal>/*.rc, and prior to the installation relative files. Since the Unix
processing supports both a directory and a file (the former overriding the
latter), and since %HOME% supports both `*.ini` and `.hgrc` (again, the former
overriding the latter), this does too. The Unix file doesn't have a `.` prefix,
so it's not used here either.
Note that this is the opposite order of processing the exe relative paths. But
since it's in agreement with Unix, %HOME% and %USERPROFILE%, it seems reasonable
to ignore that. Maybe we can change that and take a BC, because that's
something the installer should be controlling, and I can't imagine people having
both paths *and* conflicting settings.
Differential Revision: https://phab.mercurial-scm.org/D7692
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 17 Dec 2019 22:08:07 -0500 |
parents | 7929bb58146f |
children | 9ac96b9fa76e |
comparison
equal
deleted
inserted
replaced
43955:5685ce2ea3bf | 43956:1ccf340acf14 |
---|---|
36 rcpath.append(os.path.join(progrcd, f)) | 36 rcpath.append(os.path.join(progrcd, f)) |
37 | 37 |
38 # Use hgrc.d found in directory with hg.exe | 38 # Use hgrc.d found in directory with hg.exe |
39 _processdir(os.path.join(os.path.dirname(filename), b'hgrc.d')) | 39 _processdir(os.path.join(os.path.dirname(filename), b'hgrc.d')) |
40 | 40 |
41 # treat a PROGRAMDATA directory as equivalent to /etc/mercurial | |
42 programdata = encoding.environ.get(b'PROGRAMDATA') | |
43 if programdata: | |
44 programdata = os.path.join(programdata, b'Mercurial') | |
45 _processdir(os.path.join(programdata, b'hgrc.d')) | |
46 | |
47 ini = os.path.join(programdata, b'mercurial.ini') | |
48 if os.path.isfile(ini): | |
49 rcpath.append(ini) | |
50 | |
51 ini = os.path.join(programdata, b'hgrc') | |
52 if os.path.isfile(ini): | |
53 rcpath.append(ini) | |
54 | |
41 # next look for a system rcpath in the registry | 55 # next look for a system rcpath in the registry |
42 value = util.lookupreg( | 56 value = util.lookupreg( |
43 b'SOFTWARE\\Mercurial', None, winreg.HKEY_LOCAL_MACHINE | 57 b'SOFTWARE\\Mercurial', None, winreg.HKEY_LOCAL_MACHINE |
44 ) | 58 ) |
45 if value and isinstance(value, bytes): | 59 if value and isinstance(value, bytes): |