Show More
@@ -128,7 +128,7 b' elements = {' | |||
|
128 | 128 | |
|
129 | 129 | keywords = set(['and', 'or', 'not']) |
|
130 | 130 | |
|
131 | def tokenize(program): | |
|
131 | def tokenize(program, lookup=None): | |
|
132 | 132 | ''' |
|
133 | 133 | Parse a revset statement into a stream of tokens |
|
134 | 134 | |
@@ -2023,14 +2023,17 b' def findaliases(ui, tree):' | |||
|
2023 | 2023 | aliases[alias.name] = alias |
|
2024 | 2024 | return _expandaliases(aliases, tree, [], {}) |
|
2025 | 2025 | |
|
2026 | def parse(spec): | |
|
2026 | def parse(spec, lookup=None): | |
|
2027 | 2027 | p = parser.parser(tokenize, elements) |
|
2028 | return p.parse(spec) | |
|
2029 | ||
|
2030 | def match(ui, spec): | |
|
2028 | return p.parse(spec, lookup=lookup) | |
|
2029 | ||
|
2030 | def match(ui, spec, repo=None): | |
|
2031 | 2031 | if not spec: |
|
2032 | 2032 | raise error.ParseError(_("empty query")) |
|
2033 | tree, pos = parse(spec) | |
|
2033 | lookup = None | |
|
2034 | if repo: | |
|
2035 | lookup = repo.__contains__ | |
|
2036 | tree, pos = parse(spec, lookup) | |
|
2034 | 2037 | if (pos != len(spec)): |
|
2035 | 2038 | raise error.ParseError(_("invalid token"), pos) |
|
2036 | 2039 | if ui: |
General Comments 0
You need to be logged in to leave comments.
Login now