[PATCH 4 of 4 V2] templater: add symbol to error
Ryan McElroy
ryanmce at gmail.com
Mon Jun 30 03:16:22 CDT 2014
# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1402621641 25200
# Thu Jun 12 18:07:21 2014 -0700
# Node ID fb64043de7c4ffc79ad3639d2061e1861522c084
# Parent ef4d286cea6073a99bc1b6196dc35627ee89ad8e
templater: add symbol to error
This patch makes it easier to debug writing templater functions by
telling the user exactly what was sent to the templater.
diff -r ef4d286cea60 -r fb64043de7c4 mercurial/templater.py
--- a/mercurial/templater.py Thu Jun 12 18:02:23 2014 -0700
+++ b/mercurial/templater.py Thu Jun 12 18:07:21 2014 -0700
@@ -111,7 +111,7 @@
def getsymbol(exp):
if exp[0] == 'symbol':
return exp[1]
- raise error.ParseError(_("expected a symbol"))
+ raise error.ParseError(_("expected a symbol, got '%s'") % exp[0])
def getlist(x):
if not x:
diff -r ef4d286cea60 -r fb64043de7c4 tests/test-command-template.t
--- a/tests/test-command-template.t Thu Jun 12 18:02:23 2014 -0700
+++ b/tests/test-command-template.t Thu Jun 12 18:07:21 2014 -0700
@@ -1959,3 +1959,9 @@
|
o line 1
line 2
+
+Test bad template with better error message
+
+ $ hg log -Gv -R a --template '{desc|user()}'
+ hg: parse error: expected a symbol, got 'func'
+ [255]
More information about the Mercurial-devel
mailing list