[PATCH] scmutil: fix systemrcpath regression introduced in f5dd179bfa4a
Wolfgang Treutterer
Wolfgang.Treutterer at ipp.mpg.de
Fri Apr 13 08:34:22 UTC 2012
Changeset f5dd179bfa4a (plan9: initial support for plan 9 from bell
labs) broke mercurials configuration file lookup. hgrc files located
relative to the installation root are no longer read.
If mercurial is installed e.g. in /usr/local/bin the regression can be
verified in the output of the command "hg showconfig --debug":
read config from: /etc/mercurial/hgrc
read config from: /etc/mercurial/hgrc
read config from: /$HOME/.hgrc
...
The system-wide "/etc/mercurial/hgrc" shows up twice in the initial
whereas the installation-dependent location
"/usr/local/etc/mercurial/hgrc" is missing.
The reason is that hangeset f5dd179bfa4a introduced a 'root' path
component to look for hgrc files, which is used both as an absolute path
and a path relative to the <install-root>.
The latter one was broken since 'root' was set to an absolute location
and the subsequent os.path.join discarded the <install-root> path prefix.
This patch changes 'root' to a relative path, such that os.path.join
works as expected. The "/" prefix for the system-wide location is added
separately.
# HG changeset patch
# User wot
# Date 1334304488 -7200
# Node ID 4e18cfcb2533e2ad0b672a1a40e41cca6b3e8c98
# Parent ee163a9cf37c5783b7707f3264e3be901255ce25
scmutil: fix systemrcpath regression introduced in f5dd179bfa4a
Changeset f5dd179bfa4a introduced a 'root' path component to look for
hgrc files, which is used both as an absolute path and a path relative
to the <install-root>.
The latter one was broken since 'root' was set to an absolute location
and the subsequent os.path.join discarded the <install-root> path prefix.
diff -r ee163a9cf37c -r 4e18cfcb2533 mercurial/scmutil.py
--- a/mercurial/scmutil.py Tue Apr 10 16:53:29 2012 -0500
+++ b/mercurial/scmutil.py Fri Apr 13 10:08:08 2012 +0200
@@ -437,14 +437,14 @@
def systemrcpath():
path = []
if sys.platform == 'plan9':
- root = '/lib/mercurial'
+ root = 'lib/mercurial'
else:
- root = '/etc/mercurial'
+ root = 'etc/mercurial'
# old mod_python does not set sys.argv
if len(getattr(sys, 'argv', [])) > 0:
p = os.path.dirname(os.path.dirname(sys.argv[0]))
path.extend(rcfiles(os.path.join(p, root)))
- path.extend(rcfiles(root))
+ path.extend(rcfiles('/' + root))
return path
def userrcpath():
More information about the Mercurial-devel
mailing list