scmutil: improve path calculation for install-relative RC files (
issue2841)
This code was ugly and might do the wrong thing with symlinks.
--- 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