diff --git a/mercurial/config.py b/mercurial/config.py --- a/mercurial/config.py +++ b/mercurial/config.py @@ -13,6 +13,7 @@ import os from .i18n import _ from .pycompat import getattr from . import ( + encoding, error, pycompat, util, @@ -173,7 +174,7 @@ class config(object): if inst.errno != errno.ENOENT: raise error.ParseError( _(b"cannot include %s (%s)") - % (inc, inst.strerror), + % (inc, encoding.strtolocal(inst.strerror)), b"%s:%d" % (src, line), ) continue diff --git a/tests/test-hgrc.t b/tests/test-hgrc.t --- a/tests/test-hgrc.t +++ b/tests/test-hgrc.t @@ -49,6 +49,18 @@ Issue1199: Can't use '%' in hgrc (eg url paths.default=$TESTTMP/foo%bar $ cd .. +Check %include + + $ echo '[section]' > $TESTTMP/included + $ echo 'option = value' >> $TESTTMP/included + $ echo '%include $TESTTMP/included' >> $HGRC + $ hg showconfig section + section.option=value + $ chmod u-r $TESTTMP/included + $ hg showconfig section + hg: parse error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included (Permission denied) + [255] + issue1829: wrong indentation $ echo '[foo]' > $HGRC