# HG changeset patch # User Steve Borho # Date 1265542462 21600 # Node ID 07bd7608a0ea3fe9d27e80105bf645aa4fc7322c # Parent 9b87c5f4c634b9718940e6380a62d7fcf1bcddaf win32: allow hgrc.d on Windows diff -r 9b87c5f4c634 -r 07bd7608a0ea doc/hgrc.5.txt --- 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) ``\Mercurial.ini`` +| (Windows) ``\hgrc.d\*.rc`` | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` -| (Windows) ``\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 ------ diff -r 9b87c5f4c634 -r 07bd7608a0ea mercurial/win32.py --- 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(