# HG changeset patch # User Shane Holloway # Date 1171491606 25200 # Node ID 33c369afec947c67f69ae56b980a45929d166976 # Parent 6b2909e8420357c5e9a93b5dc9f465cc2e5ee312 Unified *_rcpath so the interface is similar across operating systems Changed os_rcpath to combine system_rcpath and user_rcpath. Changed system_rcpath and user_rcpath to both return a list of paths to add to the combined rcpath for both Windows NT and other platforms. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -799,16 +799,18 @@ if os.name == 'nt': def os_rcpath(): '''return default os-specific hgrc search path''' path = system_rcpath() - path.append(user_rcpath()) + path.extend(user_rcpath()) + path = [os.path.normpath(f) for f in path] + return path + + def user_rcpath(): + '''return os-specific hgrc search path to the user dir''' + path = [os.path.join(os.path.expanduser('~'), 'mercurial.ini')] userprofile = os.environ.get('USERPROFILE') if userprofile: path.append(os.path.join(userprofile, 'mercurial.ini')) return path - def user_rcpath(): - '''return os-specific hgrc search path to the user dir''' - return os.path.join(os.path.expanduser('~'), 'mercurial.ini') - def parse_patch_output(output_line): """parses the output produced by patch and returns the file name""" pf = output_line[14:] @@ -880,16 +882,23 @@ else: def os_rcpath(): '''return default os-specific hgrc search path''' + path = system_rcpath() + path.extend(user_rcpath()) + path = [os.path.normpath(f) for f in path] + return path + + def system_rcpath(): path = [] # old mod_python does not set sys.argv if len(getattr(sys, 'argv', [])) > 0: path.extend(rcfiles(os.path.dirname(sys.argv[0]) + '/../etc/mercurial')) path.extend(rcfiles('/etc/mercurial')) - path.append(os.path.expanduser('~/.hgrc')) - path = [os.path.normpath(f) for f in path] return path + def user_rcpath(): + return [os.path.expanduser('~/.hgrc')] + def parse_patch_output(output_line): """parses the output produced by patch and returns the file name""" pf = output_line[14:]