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.
--- a/mercurial/util.py Tue Jan 30 23:09:06 2007 -0500
+++ b/mercurial/util.py Wed Feb 14 15:20:06 2007 -0700
@@ -799,16 +799,18 @@
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 @@
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:]