mercurial/scmwindows.py
changeset 32208 d74b0cff94a9
parent 32078 bf5e13e38390
child 37095 e24802ea8dbd
equal deleted inserted replaced
32203:0c73634d0570 32208:d74b0cff94a9
     2 
     2 
     3 import os
     3 import os
     4 
     4 
     5 from . import (
     5 from . import (
     6     encoding,
     6     encoding,
     7     osutil,
       
     8     pycompat,
     7     pycompat,
     9     util,
     8     util,
    10     win32,
     9     win32,
    11 )
    10 )
    12 
    11 
    27     progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
    26     progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
    28     rcpath.append(progrc)
    27     rcpath.append(progrc)
    29     # Use hgrc.d found in directory with hg.exe
    28     # Use hgrc.d found in directory with hg.exe
    30     progrcd = os.path.join(os.path.dirname(filename), 'hgrc.d')
    29     progrcd = os.path.join(os.path.dirname(filename), 'hgrc.d')
    31     if os.path.isdir(progrcd):
    30     if os.path.isdir(progrcd):
    32         for f, kind in osutil.listdir(progrcd):
    31         for f, kind in util.listdir(progrcd):
    33             if f.endswith('.rc'):
    32             if f.endswith('.rc'):
    34                 rcpath.append(os.path.join(progrcd, f))
    33                 rcpath.append(os.path.join(progrcd, f))
    35     # else look for a system rcpath in the registry
    34     # else look for a system rcpath in the registry
    36     value = util.lookupreg('SOFTWARE\\Mercurial', None,
    35     value = util.lookupreg('SOFTWARE\\Mercurial', None,
    37                            winreg.HKEY_LOCAL_MACHINE)
    36                            winreg.HKEY_LOCAL_MACHINE)
    40     value = util.localpath(value)
    39     value = util.localpath(value)
    41     for p in value.split(pycompat.ospathsep):
    40     for p in value.split(pycompat.ospathsep):
    42         if p.lower().endswith('mercurial.ini'):
    41         if p.lower().endswith('mercurial.ini'):
    43             rcpath.append(p)
    42             rcpath.append(p)
    44         elif os.path.isdir(p):
    43         elif os.path.isdir(p):
    45             for f, kind in osutil.listdir(p):
    44             for f, kind in util.listdir(p):
    46                 if f.endswith('.rc'):
    45                 if f.endswith('.rc'):
    47                     rcpath.append(os.path.join(p, f))
    46                     rcpath.append(os.path.join(p, f))
    48     return rcpath
    47     return rcpath
    49 
    48 
    50 def userrcpath():
    49 def userrcpath():