Mercurial > public > mercurial-scm > hg
diff tests/test-command-template.t @ 26188:662ea52d5dca
templater: catch regexp error at sub() function
This patch splits re.sub() into re.compile() and sub() so that it can
distinguish which argument causes re.error.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 07 Sep 2015 21:58:17 +0900 |
parents | 51f6940d3b4f |
children | 72aad184f061 |
line wrap: on
line diff
--- a/tests/test-command-template.t Tue Sep 08 23:00:44 2015 +0900 +++ b/tests/test-command-template.t Mon Sep 07 21:58:17 2015 +0900 @@ -2731,6 +2731,13 @@ $ hg log -R latesttag -r 10 --template '{sub("[0-9]", "x", "{rev}")}\n' xx + $ hg log -R latesttag -r 10 -T '{sub("[", "x", rev)}\n' + hg: parse error: sub got an invalid pattern: [ + [255] + $ hg log -R latesttag -r 10 -T '{sub("[0-9]", r"\1", rev)}\n' + hg: parse error: sub got an invalid replacement: \1 + [255] + Test the strip function with chars specified: $ hg log -R latesttag --template '{desc}\n'