##// END OF EJS Templates
config: move message about leading spaces in config to config.py...
Martin von Zweigbergk -
r46362:0883413e default
parent child Browse files
Show More
@@ -200,7 +200,10 b' class config(object):'
200 self._unset.append((section, name))
200 self._unset.append((section, name))
201 continue
201 continue
202
202
203 raise error.ParseError(l.rstrip(), (b"%s:%d" % (src, line)))
203 message = l.rstrip()
204 if l.startswith(b' '):
205 message = b"unexpected leading whitespace: %s" % message
206 raise error.ParseError(message, (b"%s:%d" % (src, line)))
204
207
205 def read(self, path, fp=None, sections=None, remap=None):
208 def read(self, path, fp=None, sections=None, remap=None):
206 if not fp:
209 if not fp:
@@ -248,8 +248,6 b' def _formatparse(write, inst):'
248 _(b"hg: parse error at %s: %s\n")
248 _(b"hg: parse error at %s: %s\n")
249 % (pycompat.bytestr(inst.location), inst.message)
249 % (pycompat.bytestr(inst.location), inst.message)
250 )
250 )
251 if inst.message.startswith(b' '):
252 write(_(b"unexpected leading whitespace\n"))
253 else:
251 else:
254 write(_(b"hg: parse error: %s\n") % inst.message)
252 write(_(b"hg: parse error: %s\n") % inst.message)
255 _reportsimilar(write, similar)
253 _reportsimilar(write, similar)
@@ -25,8 +25,7 b' Test hint about invalid syntax from lead'
25 > key=value
25 > key=value
26 > EOF
26 > EOF
27 $ hg showconfig
27 $ hg showconfig
28 hg: parse error at $TESTTMP/.hg/hgrc:1: key=value
28 hg: parse error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: key=value
29 unexpected leading whitespace
30 [255]
29 [255]
31
30
32 $ cat > .hg/hgrc << EOF
31 $ cat > .hg/hgrc << EOF
@@ -34,8 +33,7 b' Test hint about invalid syntax from lead'
34 > key=value
33 > key=value
35 > EOF
34 > EOF
36 $ hg showconfig
35 $ hg showconfig
37 hg: parse error at $TESTTMP/.hg/hgrc:1: [section]
36 hg: parse error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: [section]
38 unexpected leading whitespace
39 [255]
37 [255]
40
38
41 Reset hgrc
39 Reset hgrc
@@ -68,8 +68,7 b' issue1829: wrong indentation'
68 $ echo '[foo]' > $HGRC
68 $ echo '[foo]' > $HGRC
69 $ echo ' x = y' >> $HGRC
69 $ echo ' x = y' >> $HGRC
70 $ hg version
70 $ hg version
71 hg: parse error at $TESTTMP/hgrc:2: x = y
71 hg: parse error at $TESTTMP/hgrc:2: unexpected leading whitespace: x = y
72 unexpected leading whitespace
73 [255]
72 [255]
74
73
75 $ "$PYTHON" -c "from __future__ import print_function; print('[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n')" \
74 $ "$PYTHON" -c "from __future__ import print_function; print('[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n')" \
General Comments 0
You need to be logged in to leave comments. Login now