[PATCH stable] templater: handle a missing value correctly
Ross Lagerwall
rosslagerwall at gmail.com
Sat Aug 4 08:08:08 CDT 2012
# HG changeset patch
# User Ross Lagerwall <rosslagerwall at gmail.com>
# Date 1344083837 -7200
# Branch stable
# Node ID ed99b19d78bd5ba28f072e5f217b4da7be209798
# Parent e15765c18ebc18448addb955d2b698c75fc8b380
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 63c47e4ac617.
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -295,6 +295,8 @@
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)
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -463,6 +463,13 @@
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
More information about the Mercurial-devel
mailing list