templater: handle a missing value correctly

Before, using a broken style such as:
changeset =
would result in a traceback.

This fixes a regression introduced in 47618355ffc8.
This commit is contained in:
Ross Lagerwall 2012-08-04 14:37:17 +02:00
parent 7f1365342e
commit 48a670fcaf
2 changed files with 9 additions and 0 deletions

View File

@ -295,6 +295,8 @@ class templater(object):
conf.read(mapfile)
for key, val in conf[''].items():
if not val:
raise SyntaxError(_('%s: missing value') % conf.source('', key))
if val[0] in "'\"":
try:
self.cache[key] = parsestring(val)

View File

@ -463,6 +463,13 @@ Error if style missing key:
abort: "changeset" not in template map
[255]
Error if style missing value:
$ echo 'changeset =' > t
$ hg log --style t
abort: t:1: missing value
[255]
Error if include fails:
$ echo 'changeset = q' >> t