[issue1999] config: continuation lines must be > 1 char long

Greg Ward bugs at mercurial.selenic.com
Tue Jan 26 23:10:04 UTC 2010


New submission from Greg Ward <greg-hg at gerg.ca>:

I have a config key (used by a local hook) that lists file extensions.  Example:

  txt_extensions = c h java txt cpp hpp

It's getting long, so I just split it up using continuation lines:

  txt_extensions =
    c
    h
    java
    txt
    cpp
    hpp

To my surprise, this syntax is not accepted.  I get an error like

  hg: config error at /home/gward/repos/trunk/.hg/hgrc:3: '  c'

Turns out the culprit is this regex in config.py:

  contre = re.compile(r'\s+(\S.*\S)')

This means that a continuation line must consist of at least 2
non-whitespace characters.  That was slightly annoying and rather surprising.

Incidentally, the current definition of contre dates from

changeset:   8192:5fd8e60a935d
user:        Matt Mackall <mpm at selenic.com>
date:        2009-04-26 16:50:43 -0500
files:
  M mercurial/config.py
description:
config: deal with spaces at end of line more carefully

----------
messages: 11515
nosy: gward
priority: bug
status: unread
title: config: continuation lines must be > 1 char long

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue1999>
____________________________________________________


More information about the Mercurial-devel mailing list