mercurial/util.py
changeset 4083 33c369afec94
parent 4069 3fef134832d8
child 4096 49237d6ae97d
--- 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:]