# HG changeset patch # User Steve Borho # Date 2010-02-07 11:34:22 # Node ID 07bd7608a0ea3fe9d27e80105bf645aa4fc7322c # Parent 9b87c5f4c634b9718940e6380a62d7fcf1bcddaf win32: allow hgrc.d on Windows diff --git a/doc/hgrc.5.txt b/doc/hgrc.5.txt --- a/doc/hgrc.5.txt +++ b/doc/hgrc.5.txt @@ -72,16 +72,19 @@ ones. 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 --git a/mercurial/win32.py b/mercurial/win32.py --- a/mercurial/win32.py +++ b/mercurial/win32.py @@ -131,6 +131,14 @@ def system_rcpath_win32(): 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(