Mercurial > hg
comparison mercurial/hgweb/webcommands.py @ 31024:0b8356705de6
revset: split language services to revsetlang module (API)
New revsetlang module hosts parser, tokenizer, and miscellaneous functions
working on parsed tree. It does not include functions for evaluation such as
getset() and match().
2288 mercurial/revset.py
684 mercurial/revsetlang.py
2972 total
get*() functions are aliased since they are common in revset.py.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 19 Feb 2017 18:19:33 +0900 |
parents | aea06029919e |
children | abb92b3d370e |
comparison
equal
deleted
inserted
replaced
31023:aea06029919e | 31024:0b8356705de6 |
---|---|
30 archival, | 30 archival, |
31 encoding, | 31 encoding, |
32 error, | 32 error, |
33 graphmod, | 33 graphmod, |
34 revset, | 34 revset, |
35 revsetlang, | |
35 scmutil, | 36 scmutil, |
36 smartset, | 37 smartset, |
37 templatefilters, | 38 templatefilters, |
38 templater, | 39 templater, |
39 util, | 40 util, |
237 else: | 238 else: |
238 return MODE_REVISION, ctx | 239 return MODE_REVISION, ctx |
239 | 240 |
240 revdef = 'reverse(%s)' % query | 241 revdef = 'reverse(%s)' % query |
241 try: | 242 try: |
242 tree = revset.parse(revdef) | 243 tree = revsetlang.parse(revdef) |
243 except error.ParseError: | 244 except error.ParseError: |
244 # can't parse to a revset tree | 245 # can't parse to a revset tree |
245 return MODE_KEYWORD, query | 246 return MODE_KEYWORD, query |
246 | 247 |
247 if revset.depth(tree) <= 2: | 248 if revsetlang.depth(tree) <= 2: |
248 # no revset syntax used | 249 # no revset syntax used |
249 return MODE_KEYWORD, query | 250 return MODE_KEYWORD, query |
250 | 251 |
251 if any((token, (value or '')[:3]) == ('string', 're:') | 252 if any((token, (value or '')[:3]) == ('string', 're:') |
252 for token, value, pos in revset.tokenize(revdef)): | 253 for token, value, pos in revsetlang.tokenize(revdef)): |
253 return MODE_KEYWORD, query | 254 return MODE_KEYWORD, query |
254 | 255 |
255 funcsused = revset.funcsused(tree) | 256 funcsused = revsetlang.funcsused(tree) |
256 if not funcsused.issubset(revset.safesymbols): | 257 if not funcsused.issubset(revset.safesymbols): |
257 return MODE_KEYWORD, query | 258 return MODE_KEYWORD, query |
258 | 259 |
259 mfunc = revset.match(web.repo.ui, revdef) | 260 mfunc = revset.match(web.repo.ui, revdef) |
260 try: | 261 try: |