[PATCH STABLE] templater: catch exception caused by template ends with backslash (issue4798)

Matt Mackall mpm at selenic.com
Fri Aug 28 17:35:27 CDT 2015


On Fri, 2015-08-28 at 23:54 +0900, Yuya Nishihara wrote:
> +common mistake of template syntax, trailing slash (issue4798)
> +
> +  $ hg id trslash://
> +  hg: parse error at 0: syntax error
> +  [255]

I don't think this is an improvement. Before this would complain about a
trailing backslash (but not say why that was a problem: because it's not
a valid template), now this has an even less helpful "syntax error" and
points to position 0 (where nothing is amiss). It does avoid spewing a
backtrace though!

I think changing "syntax error" to "string escaping error in template"
might be better.

Might be more clear to test against:

$ hg log -T "\\"

Also: you write slash instead of backslash a few places.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list