diff --git a/mercurial/config.py b/mercurial/config.py --- a/mercurial/config.py +++ b/mercurial/config.py @@ -73,10 +73,10 @@ class config(object): def parse(self, src, data, sections=None, remap=None, include=None): sectionre = re.compile(r'\[([^\[]+)\]') itemre = re.compile(r'([^=\s][^=]*?)\s*=\s*(.*\S|)') - contre = re.compile(r'\s+(\S.*\S)') + contre = re.compile(r'\s+(\S|\S.*\S)\s*$') emptyre = re.compile(r'(;|#|\s*$)') unsetre = re.compile(r'%unset\s+(\S+)') - includere = re.compile(r'%include\s+(\S.*\S)') + includere = re.compile(r'%include\s+(\S|\S.*\S)\s*$') section = "" item = None line = 0 diff --git a/tests/test-hgrc b/tests/test-hgrc --- a/tests/test-hgrc +++ b/tests/test-hgrc @@ -23,5 +23,9 @@ echo '[foo]' >> $HGRCPATH echo ' x = y' >> $HGRCPATH hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|" +python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \ + > $HGRCPATH +hg showconfig foo + 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 @@ -11,4 +11,6 @@ defaults.tag=-d "0 0" paths.default=.../foo%bar ui.slash=True hg: config error at $HGRCPATH:8: ' x = y' +foo.bar=a\nb\nc\nde\nfg +foo.baz=bif cb hg: config error at $HGRCPATH:1: cannot include /no-such-file (No such file or directory)