mercurial/util.py
changeset 4083 33c369afec94
parent 4069 3fef134832d8
child 4096 49237d6ae97d
equal deleted inserted replaced
4082:6b2909e84203 4083:33c369afec94
   797             return [r'c:\mercurial\mercurial.ini']
   797             return [r'c:\mercurial\mercurial.ini']
   798 
   798 
   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 
       
   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 
   813 
   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:]
   815         if pf[0] == '`':
   817         if pf[0] == '`':
   878             pass
   880             pass
   879         return rcs
   881         return rcs
   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
       
   898 
       
   899     def user_rcpath():
       
   900         return [os.path.expanduser('~/.hgrc')]
   892 
   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:]
   896         if pf.startswith("'") and pf.endswith("'") and " " in pf:
   905         if pf.startswith("'") and pf.endswith("'") and " " in pf: