##// END OF EJS Templates
Unified *_rcpath so the interface is similar across operating systems...
Shane Holloway -
r4083:33c369af default
parent child Browse files
Show More
@@ -799,16 +799,18 b" if os.name == 'nt':"
799 def os_rcpath():
799 def os_rcpath():
800 '''return default os-specific hgrc search path'''
800 '''return default os-specific hgrc search path'''
801 path = system_rcpath()
801 path = system_rcpath()
802 path.append(user_rcpath())
802 path.extend(user_rcpath())
803 path = [os.path.normpath(f) for f in path]
804 return path
805
806 def user_rcpath():
807 '''return os-specific hgrc search path to the user dir'''
808 path = [os.path.join(os.path.expanduser('~'), 'mercurial.ini')]
803 userprofile = os.environ.get('USERPROFILE')
809 userprofile = os.environ.get('USERPROFILE')
804 if userprofile:
810 if userprofile:
805 path.append(os.path.join(userprofile, 'mercurial.ini'))
811 path.append(os.path.join(userprofile, 'mercurial.ini'))
806 return path
812 return path
807
813
808 def user_rcpath():
809 '''return os-specific hgrc search path to the user dir'''
810 return os.path.join(os.path.expanduser('~'), 'mercurial.ini')
811
812 def parse_patch_output(output_line):
814 def parse_patch_output(output_line):
813 """parses the output produced by patch and returns the file name"""
815 """parses the output produced by patch and returns the file name"""
814 pf = output_line[14:]
816 pf = output_line[14:]
@@ -880,16 +882,23 b' else:'
880
882
881 def os_rcpath():
883 def os_rcpath():
882 '''return default os-specific hgrc search path'''
884 '''return default os-specific hgrc search path'''
885 path = system_rcpath()
886 path.extend(user_rcpath())
887 path = [os.path.normpath(f) for f in path]
888 return path
889
890 def system_rcpath():
883 path = []
891 path = []
884 # old mod_python does not set sys.argv
892 # old mod_python does not set sys.argv
885 if len(getattr(sys, 'argv', [])) > 0:
893 if len(getattr(sys, 'argv', [])) > 0:
886 path.extend(rcfiles(os.path.dirname(sys.argv[0]) +
894 path.extend(rcfiles(os.path.dirname(sys.argv[0]) +
887 '/../etc/mercurial'))
895 '/../etc/mercurial'))
888 path.extend(rcfiles('/etc/mercurial'))
896 path.extend(rcfiles('/etc/mercurial'))
889 path.append(os.path.expanduser('~/.hgrc'))
890 path = [os.path.normpath(f) for f in path]
891 return path
897 return path
892
898
899 def user_rcpath():
900 return [os.path.expanduser('~/.hgrc')]
901
893 def parse_patch_output(output_line):
902 def parse_patch_output(output_line):
894 """parses the output produced by patch and returns the file name"""
903 """parses the output produced by patch and returns the file name"""
895 pf = output_line[14:]
904 pf = output_line[14:]
General Comments 0
You need to be logged in to leave comments. Login now