scmutil: improve path calculation for install-relative RC files (issue2841)
authorMatt Mackall <mpm@selenic.com>
Fri, 03 Jun 2011 15:08:08 -0500
changeset 14527 5867bd6e7cf5
parent 14526 4276e3202585
child 14528 0bd69e37fd20
scmutil: improve path calculation for install-relative RC files (issue2841) This code was ugly and might do the wrong thing with symlinks.
mercurial/scmutil.py
--- 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