[PATCH 3 of 3] fileset: handle error of string unescaping

Yuya Nishihara yuya at tcha.org
Thu Sep 10 10:10:59 CDT 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1441895556 -32400
#      Thu Sep 10 23:32:36 2015 +0900
# Node ID 43d97e4f0b976d7b259c90ac7fab40d08608cf8e
# Parent  6cafa7cb11d94c3e3eb77aaa68288ce5255b231a
fileset: handle error of string unescaping

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -54,7 +54,7 @@ def tokenize(program):
                 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
diff --git a/tests/test-fileset.t b/tests/test-fileset.t
--- a/tests/test-fileset.t
+++ b/tests/test-fileset.t
@@ -49,6 +49,9 @@ Test operators and basic patterns
   $ fileset 'a* - a1'
   a2
   $ fileset 'a_b'
+  $ fileset '"\xy"'
+  hg: parse error: invalid \x escape
+  [255]
 
 Test files status
 


More information about the Mercurial-devel mailing list