changeset 10388:07bd7608a0ea

win32: allow hgrc.d on Windows
author Steve Borho <steve@borho.org>
date Sun, 07 Feb 2010 05:34:22 -0600
parents 9b87c5f4c634
children 6dc25b01e170
files doc/hgrc.5.txt mercurial/win32.py
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hgrc.5.txt	Mon Feb 08 00:01:08 2010 +0100
+++ b/doc/hgrc.5.txt	Sun Feb 07 05:34:22 2010 -0600
@@ -72,16 +72,19 @@
     in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
     to all Mercurial commands executed by any user in any directory.
 
-| (Windows) ``C:\Mercurial\Mercurial.ini``
+| (Windows) ``<install-dir>\Mercurial.ini``
+| (Windows) ``<install-dir>\hgrc.d\*.rc``
 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
-| (Windows) ``<install-dir>\Mercurial.ini``
 
     Per-installation/system configuration files, for the system on
     which Mercurial is running. Options in these files apply to all
     Mercurial commands executed by any user in any directory. Registry
     keys contain PATH-like strings, every part of which must reference
     a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
-    be read.
+    be read.  Mercurial checks each of these locations in the specified
+    order until one or more configuration files are detected.  If the
+    py2win32 extensions are not installed, Mercurial will only look for
+    site-wide configuration in ``C:\Mercurial\Mercurial.ini``.
 
 Syntax
 ------
--- a/mercurial/win32.py	Mon Feb 08 00:01:08 2010 +0100
+++ b/mercurial/win32.py	Sun Feb 07 05:34:22 2010 -0600
@@ -131,6 +131,14 @@
     progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
     if os.path.isfile(progrc):
         return [progrc]
+    # Use hgrc.d found in directory with hg.exe
+    progrcd = os.path.join(os.path.dirname(filename), 'hgrc.d')
+    if os.path.isdir(progrcd):
+        rcpath = []
+        for f, kind in osutil.listdir(progrcd):
+            if f.endswith('.rc'):
+                rcpath.append(os.path.join(progrcd, f))
+        return rcpath
     # else look for a system rcpath in the registry
     try:
         value = win32api.RegQueryValue(