Patchwork [3,of,3] fileset: handle error of string unescaping

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 10, 2015, 3:10 p.m.
Message ID <43d97e4f0b976d7b259c.1441897859@mimosa>
Download mbox | patch
Permalink /patch/10465/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 10, 2015, 3:10 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1441895556 -32400
#      Thu Sep 10 23:32:36 2015 +0900
# Node ID 43d97e4f0b976d7b259c90ac7fab40d08608cf8e
# Parent  6cafa7cb11d94c3e3eb77aaa68288ce5255b231a
fileset: handle error of string unescaping
Matt Mackall - Sept. 13, 2015, 4:14 a.m.
On Fri, 2015-09-11 at 00:10 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1441895556 -32400
> #      Thu Sep 10 23:32:36 2015 +0900
> # Node ID 43d97e4f0b976d7b259c90ac7fab40d08608cf8e
> # Parent  6cafa7cb11d94c3e3eb77aaa68288ce5255b231a
> fileset: handle error of string unescaping

These are queued for default, thanks.

Patch

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