Patchwork [2,of,4] py3: convert set of revset initial symbols back to bytes

login
register
mail settings
Submitter Yuya Nishihara
Date March 13, 2017, 12:41 a.m.
Message ID <06527fc4ae45e3950b09.1489365714@mimosa>
Download mbox | patch
Permalink /patch/19265/
State Accepted
Headers show

Comments

Yuya Nishihara - March 13, 2017, 12:41 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1489363814 25200
#      Sun Mar 12 17:10:14 2017 -0700
# Node ID 06527fc4ae45e3950b098a2509a6a55b4a275a2f
# Parent  75c128696f8dbc4aaa56f0e2200ebd7f560a36d5
py3: convert set of revset initial symbols back to bytes

Otherwise tokenize() would fail due to comparison between unicode and bytes.

Patch

diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -46,12 +46,13 @@  elements = {
 keywords = set(['and', 'or', 'not'])
 
 # default set of valid characters for the initial letter of symbols
-_syminitletters = set(
-    string.ascii_letters +
-    string.digits + pycompat.sysstr('._@')) | set(map(chr, xrange(128, 256)))
+_syminitletters = set(pycompat.iterbytestr(
+    string.ascii_letters.encode('ascii') +
+    string.digits.encode('ascii') +
+    '._@')) | set(map(pycompat.bytechr, xrange(128, 256)))
 
 # default set of valid characters for non-initial letters of symbols
-_symletters = _syminitletters | set(pycompat.sysstr('-/'))
+_symletters = _syminitletters | set(pycompat.iterbytestr('-/'))
 
 def tokenize(program, lookup=None, syminitletters=None, symletters=None):
     '''