# HG changeset patch # User Yuya Nishihara # Date 1491034368 -32400 # Node ID 4c3a4bb31c0e3d9b8920b4c9b64ae930b1fe52ce # Parent 3a8810c1b9bc6371c1940c0ad30212bbad4f6e0e revsetlang: raise ParseError to report invalid format character It's more common in revset and templater than raising Abort. I have a couple more patches to address exceptions caused by bad format string passed to revset() template function. diff -r 3a8810c1b9bc -r 4c3a4bb31c0e mercurial/revsetlang.py --- a/mercurial/revsetlang.py Sat Apr 01 17:04:49 2017 +0900 +++ b/mercurial/revsetlang.py Sat Apr 01 17:12:48 2017 +0900 @@ -641,7 +641,8 @@ d = expr[pos] ret.append(listexp(list(next(argiter)), d)) else: - raise error.Abort(_('unexpected revspec format character %s') % d) + raise error.ParseError(_('unexpected revspec format character %s') + % d) pos += 1 return ''.join(ret) diff -r 3a8810c1b9bc -r 4c3a4bb31c0e tests/test-command-template.t --- a/tests/test-command-template.t Sat Apr 01 17:04:49 2017 +0900 +++ b/tests/test-command-template.t Sat Apr 01 17:12:48 2017 +0900 @@ -4080,6 +4080,12 @@ 5:13207e5a10d9fd28ec424934298e176197f2c67f, 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74 +Invalid arguments passed to revset() + + $ hg log -T '{revset("%whatever", 0)}\n' + hg: parse error: unexpected revspec format character w + [255] + Test files function $ hg log -T "{rev}\n{join(files('*'), '\n')}\n"