diff -r 3e394e0558d7 -r 735f47b41521 mercurial/fileset.py --- a/mercurial/fileset.py Thu Jan 04 14:20:58 2018 +0900 +++ b/mercurial/fileset.py Sat Jan 13 15:07:37 2018 +0900 @@ -99,6 +99,11 @@ raise error.ParseError(_("invalid token"), pos) return tree +def getsymbol(x): + if x and x[0] == 'symbol': + return x[1] + raise error.ParseError(_('not a symbol')) + def getstring(x, err): if x and (x[0] == 'string' or x[0] == 'symbol'): return x[1] @@ -225,8 +230,8 @@ return [f for f in mctx.subset if f in s] def func(mctx, a, b): - if a[0] == 'symbol' and a[1] in symbols: - funcname = a[1] + funcname = getsymbol(a) + if funcname in symbols: enabled = mctx._existingenabled mctx._existingenabled = funcname in _existingcallers try: @@ -237,7 +242,7 @@ keep = lambda fn: getattr(fn, '__doc__', None) is not None syms = [s for (s, fn) in symbols.items() if keep(fn)] - raise error.UnknownIdentifier(a[1], syms) + raise error.UnknownIdentifier(funcname, syms) def getlist(x): if not x: