changeset 26232:43f9976346e9

revset: handle error of string unescaping
author Yuya Nishihara <yuya@tcha.org>
date Thu, 10 Sep 2015 23:29:55 +0900
parents 87c9c562c37a
children d3dbb65c8dc6
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Sep 10 23:25:10 2015 +0900
+++ b/mercurial/revset.py	Thu Sep 10 23:29:55 2015 +0900
@@ -244,7 +244,7 @@
                 c = program[pos]
                 decode = lambda x: x
             else:
-                decode = lambda x: x.decode('string-escape')
+                decode = parser.unescapestr
             pos += 1
             s = pos
             while pos < l: # find closing quote
--- a/tests/test-revset.t	Thu Sep 10 23:25:10 2015 +0900
+++ b/tests/test-revset.t	Thu Sep 10 23:29:55 2015 +0900
@@ -353,6 +353,9 @@
   $ log 'date('
   hg: parse error at 5: not a prefix: end
   [255]
+  $ log 'date("\xy")'
+  hg: parse error: invalid \x escape
+  [255]
   $ log 'date(tip)'
   abort: invalid date: 'tip'
   [255]