diff --git a/mercurial/config.py b/mercurial/config.py --- a/mercurial/config.py +++ b/mercurial/config.py @@ -100,7 +100,13 @@ class config(object): base = os.path.dirname(src) inc = os.path.normpath(os.path.join(base, inc)) if include: - include(inc, remap=remap, sections=sections) + try: + include(inc, remap=remap, sections=sections) + except IOError, inst: + msg = _("config error at %s:%d: " + "cannot include %s (%s)") \ + % (src, line, inc, inst.strerror) + raise error.ConfigError(msg) continue if emptyre.match(l): continue diff --git a/tests/test-hgrc b/tests/test-hgrc --- a/tests/test-hgrc +++ b/tests/test-hgrc @@ -18,3 +18,6 @@ cd .. echo '[foo]' > $HGRCPATH echo ' x = y' >> $HGRCPATH hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|" + +echo '%include /no-such-file' > $HGRCPATH +hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|" diff --git a/tests/test-hgrc.out b/tests/test-hgrc.out --- a/tests/test-hgrc.out +++ b/tests/test-hgrc.out @@ -7,3 +7,4 @@ default = .../foo%bar bundle.mainreporoot=.../foobar paths.default=.../foo%bar hg: config error at $HGRCPATH:2: ' x = y' +hg: config error at $HGRCPATH:1: cannot include /no-such-file (No such file or directory)