# HG changeset patch # User Ross Lagerwall # Date 2012-08-04 12:37:17 # Node ID 39c01f8e7b39d986923b5445c1a51e323221bc75 # Parent ba36e771f268f556fd0a4d93a95479dba0dd1ed7 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 @@ 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) 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 @@ 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