On Windows look for mercurial.ini in $USERPROFILE, too, if available
authorThomas Arendsen Hein <thomas@intevation.de>
Sun, 14 May 2006 18:24:32 +0200
changeset 2280 09ed44225571
parent 2279 51bfa0fd3a33
child 2282 2efa636eb411
child 2289 854954fd410a
On Windows look for mercurial.ini in $USERPROFILE, too, if available as os.path.expanduser('~') does not always yield a useful directory. Based on a patch from Edouard Gomez <ed.gomez@free.fr>
mercurial/util.py
--- a/mercurial/util.py	Sat May 13 23:00:46 2006 -0700
+++ b/mercurial/util.py	Sun May 14 18:24:32 2006 +0200
@@ -535,8 +535,12 @@
 
     def os_rcpath():
         '''return default os-specific hgrc search path'''
-        return system_rcpath() + [os.path.join(os.path.expanduser('~'),
-                                               'mercurial.ini')]
+        path = system_rcpath()
+        path.append(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 parse_patch_output(output_line):
         """parses the output produced by patch and returns the file name"""