##// END OF EJS Templates
fileset: move validation of incomplete parsing to parse() function...
Yuya Nishihara -
r25252:ac381dd7 default
parent child Browse files
Show More
@@ -2164,7 +2164,7 b' def debugfileset(ui, repo, expr, **opts)'
2164 '''parse and apply a fileset specification'''
2164 '''parse and apply a fileset specification'''
2165 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
2165 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
2166 if ui.verbose:
2166 if ui.verbose:
2167 tree = fileset.parse(expr)[0]
2167 tree = fileset.parse(expr)
2168 ui.note(tree, "\n")
2168 ui.note(tree, "\n")
2169
2169
2170 for f in ctx.getfileset(expr):
2170 for f in ctx.getfileset(expr):
@@ -81,7 +81,10 b' def tokenize(program):'
81
81
82 def parse(expr):
82 def parse(expr):
83 p = parser.parser(tokenize, elements)
83 p = parser.parser(tokenize, elements)
84 return p.parse(expr)
84 tree, pos = p.parse(expr)
85 if pos != len(expr):
86 raise error.ParseError(_("invalid token"), pos)
87 return tree
85
88
86 def getstring(x, err):
89 def getstring(x, err):
87 if x and (x[0] == 'string' or x[0] == 'symbol'):
90 if x and (x[0] == 'string' or x[0] == 'symbol'):
@@ -491,9 +494,7 b' def _intree(funcs, tree):'
491 ]
494 ]
492
495
493 def getfileset(ctx, expr):
496 def getfileset(ctx, expr):
494 tree, pos = parse(expr)
497 tree = parse(expr)
495 if (pos != len(expr)):
496 raise error.ParseError(_("invalid token"), pos)
497
498
498 # do we need status info?
499 # do we need status info?
499 if (_intree(['modified', 'added', 'removed', 'deleted',
500 if (_intree(['modified', 'added', 'removed', 'deleted',
General Comments 0
You need to be logged in to leave comments. Login now