# HG changeset patch # User Matt Mackall # Date 2012-10-30 23:48:44 # Node ID d8905e2c1301841da1d76ccf396ec6be3ee4ea61 # Parent 9a2cf955db84740077503291cb45c1aa8603c213 revset: accept @ in unquoted symbols (issue3686) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -105,6 +105,15 @@ elements = { keywords = set(['and', 'or', 'not']) def tokenize(program): + ''' + Parse a revset statement into a stream of tokens + + Check that @ is a valid unquoted token character (issue3686): + >>> list(tokenize("@::")) + [('symbol', '@', 0), ('::', None, 1), ('end', None, 3)] + + ''' + pos, l = 0, len(program) while pos < l: c = program[pos] @@ -140,12 +149,12 @@ def tokenize(program): else: raise error.ParseError(_("unterminated string"), s) # gather up a symbol/keyword - elif c.isalnum() or c in '._' or ord(c) > 127: + elif c.isalnum() or c in '._@' or ord(c) > 127: s = pos pos += 1 while pos < l: # find end of symbol d = program[pos] - if not (d.isalnum() or d in "._/" or ord(d) > 127): + if not (d.isalnum() or d in "._/@" or ord(d) > 127): break if d == '.' and program[pos - 1] == '.': # special case for .. pos -= 1