diff mercurial/windows.py @ 13986:9c374cf76b7d

move system_rcpath and user_rcpath to scmutil
author Adrian Buehlmann <adrian@cadifra.com>
date Thu, 21 Apr 2011 21:16:54 +0200
parents 31eb145b50b6
children 97ed99d1f419
line wrap: on
line diff
--- a/mercurial/windows.py	Thu Apr 21 20:54:45 2011 +0200
+++ b/mercurial/windows.py	Thu Apr 21 21:16:54 2011 +0200
@@ -73,49 +73,6 @@
 def openhardlinks():
     return not _is_win_9x()
 
-_HKEY_LOCAL_MACHINE = 0x80000002L
-
-def system_rcpath():
-    '''return default os-specific hgrc search path'''
-    rcpath = []
-    filename = executable_path()
-    # Use mercurial.ini found in directory with hg.exe
-    progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
-    if os.path.isfile(progrc):
-        rcpath.append(progrc)
-        return rcpath
-    # Use hgrc.d found in directory with hg.exe
-    progrcd = os.path.join(os.path.dirname(filename), 'hgrc.d')
-    if os.path.isdir(progrcd):
-        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
-    value = lookup_reg('SOFTWARE\\Mercurial', None, _HKEY_LOCAL_MACHINE)
-    if not isinstance(value, str) or not value:
-        return rcpath
-    value = value.replace('/', os.sep)
-    for p in value.split(os.pathsep):
-        if p.lower().endswith('mercurial.ini'):
-            rcpath.append(p)
-        elif os.path.isdir(p):
-            for f, kind in osutil.listdir(p):
-                if f.endswith('.rc'):
-                    rcpath.append(os.path.join(p, f))
-    return rcpath
-
-def user_rcpath():
-    '''return os-specific hgrc search path to the user dir'''
-    home = os.path.expanduser('~')
-    path = [os.path.join(home, 'mercurial.ini'),
-            os.path.join(home, '.hgrc')]
-    userprofile = os.environ.get('USERPROFILE')
-    if userprofile:
-        path.append(os.path.join(userprofile, 'mercurial.ini'))
-        path.append(os.path.join(userprofile, '.hgrc'))
-    return path
-
 def parse_patch_output(output_line):
     """parses the output produced by patch and returns the filename"""
     pf = output_line[14:]