changeset 14527:5867bd6e7cf5

scmutil: improve path calculation for install-relative RC files (issue2841) This code was ugly and might do the wrong thing with symlinks.
author Matt Mackall <mpm@selenic.com>
date Fri, 03 Jun 2011 15:08:08 -0500
parents 4276e3202585
children 0bd69e37fd20
files mercurial/scmutil.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Jun 03 13:10:22 2011 +0200
+++ b/mercurial/scmutil.py	Fri Jun 03 15:08:08 2011 -0500
@@ -414,8 +414,8 @@
         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'))
+            p = os.path.dirname(os.path.dirname(sys.argv[0]))
+            path.extend(rcfiles(os.path.join(p, 'etc/mercurial')))
         path.extend(rcfiles('/etc/mercurial'))
         return path