# HG changeset patch # User Matt Mackall # Date 1264741648 21600 # Node ID 44c923eeb81d64d7a00d6d2271c86821e70c95f0 # Parent d1cd09bb4d18ccfe85ae909ab81e79d626a8edf1 config: handle short continuations (issue1999) Thanks to Greg Ward for spotting and testing diff -r d1cd09bb4d18 -r 44c923eeb81d mercurial/config.py --- a/mercurial/config.py Thu Jan 28 22:45:46 2010 -0600 +++ b/mercurial/config.py Thu Jan 28 23:07:28 2010 -0600 @@ -73,10 +73,10 @@ 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 -r d1cd09bb4d18 -r 44c923eeb81d tests/test-hgrc --- a/tests/test-hgrc Thu Jan 28 22:45:46 2010 -0600 +++ b/tests/test-hgrc Thu Jan 28 23:07:28 2010 -0600 @@ -23,5 +23,9 @@ 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 -r d1cd09bb4d18 -r 44c923eeb81d tests/test-hgrc.out --- a/tests/test-hgrc.out Thu Jan 28 22:45:46 2010 -0600 +++ b/tests/test-hgrc.out Thu Jan 28 23:07:28 2010 -0600 @@ -11,4 +11,6 @@ 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)