mercurial/scmwindows.py
changeset 43956 1ccf340acf14
parent 43931 7929bb58146f
child 45843 9ac96b9fa76e
--- a/mercurial/scmwindows.py	Fri Dec 13 10:31:00 2019 -0800
+++ b/mercurial/scmwindows.py	Tue Dec 17 22:08:07 2019 -0500
@@ -38,6 +38,20 @@
     # Use hgrc.d found in directory with hg.exe
     _processdir(os.path.join(os.path.dirname(filename), b'hgrc.d'))
 
+    # treat a PROGRAMDATA directory as equivalent to /etc/mercurial
+    programdata = encoding.environ.get(b'PROGRAMDATA')
+    if programdata:
+        programdata = os.path.join(programdata, b'Mercurial')
+        _processdir(os.path.join(programdata, b'hgrc.d'))
+
+        ini = os.path.join(programdata, b'mercurial.ini')
+        if os.path.isfile(ini):
+            rcpath.append(ini)
+
+        ini = os.path.join(programdata, b'hgrc')
+        if os.path.isfile(ini):
+            rcpath.append(ini)
+
     # next look for a system rcpath in the registry
     value = util.lookupreg(
         b'SOFTWARE\\Mercurial', None, winreg.HKEY_LOCAL_MACHINE