Patchwork [4,of,4,v2] revset: build the set from a saner source: the string module

login
register
mail settings
Submitter Augie Fackler
Date Oct. 7, 2016, 3:21 p.m.
Message ID <27d370e08f7ed5311a67.1475853702@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/16899/
State Changes Requested
Headers show

Comments

Augie Fackler - Oct. 7, 2016, 3:21 p.m.
# HG changeset patch
# User Martijn Pieters <mj@zopatista.com>
# Date 1475842953 14400
#      Fri Oct 07 08:22:33 2016 -0400
# Node ID 27d370e08f7ed5311a6708a69dc86754f31e8228
# Parent  1eeb40b50d3129e5ef6b05709c5a41932a4371fb
revset: build the set from a saner source: the string module

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -9,6 +9,7 @@  from __future__ import absolute_import
 
 import heapq
 import re
+import string
 
 from .i18n import _
 from . import (
@@ -173,8 +174,8 @@  elements = {
 keywords = set(['and', 'or', 'not'])
 
 # default set of valid characters for the initial letter of symbols
-_syminitletters = set(c for c in [chr(i) for i in xrange(256)]
-                      if c.isalnum() or c in '._@' or ord(c) > 127)
+_syminitletters = set(string.ascii_letters + string.digits + u'._@') | set(
+    map(chr, xrange(128, 256)))
 
 # default set of valid characters for non-initial letters of symbols
 _symletters = _syminitletters | set(u'-/')