# HG changeset patch # User Steve Borho # Date 1196917055 21600 # Node ID 55d3e845736a664ac4e0cee22bba3f9362fca888 # Parent 6e1a61b14bbfa31c8b0af7737b7f9700c3b4a75e win32: favor local mercurial.ini over registry key Hopefully this is the best of both worlds. Multiple py2exe based installers can coexist on one machine, while source and lib based Mercurial users can still use a registry key in lieu of resorting to HGRCPATH. diff -r 6e1a61b14bbf -r 55d3e845736a mercurial/util_win32.py --- a/mercurial/util_win32.py Thu Dec 06 13:11:36 2007 -0800 +++ b/mercurial/util_win32.py Wed Dec 05 22:57:35 2007 -0600 @@ -180,6 +180,17 @@ def system_rcpath_win32(): '''return default os-specific hgrc search path''' + proc = win32api.GetCurrentProcess() + try: + # This will fail on windows < NT + filename = win32process.GetModuleFileNameEx(proc, 0) + except: + filename = win32api.GetModuleFileName(0) + # Use mercurial.ini found in directory with hg.exe + progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini') + if os.path.isfile(progrc): + return [progrc] + # else look for a system rcpath in the registry try: value = win32api.RegQueryValue( win32con.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Mercurial') @@ -193,14 +204,7 @@ rcpath.append(os.path.join(p, f)) return rcpath except pywintypes.error: - pass - proc = win32api.GetCurrentProcess() - try: - # This will fail on windows < NT - filename = win32process.GetModuleFileNameEx(proc, 0) - except: - filename = win32api.GetModuleFileName(0) - return [os.path.join(os.path.dirname(filename), 'mercurial.ini')] + return [] def user_rcpath_win32(): '''return os-specific hgrc search path to the user dir'''