[PATCH 4 of 4] revset: build the set from a saner source: the string module

Augie Fackler raf at durin42.com
Fri Oct 7 08:50:48 EDT 2016


# HG changeset patch
# User Martijn Pieters <mj at zopatista.com>
# Date 1475842953 14400
#      Fri Oct 07 08:22:33 2016 -0400
# Node ID 0c69350d0f87d3c65aa45998b24abdaf37a1772f
# Parent  24645da251e8646510978321adfa03bc47952709
revset: build the set from a saner source: the string module

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,7 @@ 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'._@')
 
 # default set of valid characters for non-initial letters of symbols
 _symletters = _syminitletters | set('-/')


More information about the Mercurial-devel mailing list