Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 29947:80c86b9bb40b
revset: forward ordering requirement to argument of present()
present() is special in that it returns the argument set with no
modification, so the ordering requirement should be forwarded.
We could make present() fix the order like orset(), but that would be silly
because we know the extra filtering cost is unnecessary.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 01 Jun 2016 20:54:04 +0900 |
parents | e34cd85dc5b1 |
children | 5f56a3b9675e |
comparison
equal
deleted
inserted
replaced
29946:3664537386ab | 29947:80c86b9bb40b |
---|---|
2471 elif op == 'list': | 2471 elif op == 'list': |
2472 return (op,) + tuple(_analyze(y, order) for y in x[1:]) | 2472 return (op,) + tuple(_analyze(y, order) for y in x[1:]) |
2473 elif op == 'keyvalue': | 2473 elif op == 'keyvalue': |
2474 return (op, x[1], _analyze(x[2], order)) | 2474 return (op, x[1], _analyze(x[2], order)) |
2475 elif op == 'func': | 2475 elif op == 'func': |
2476 return (op, x[1], _analyze(x[2], defineorder), order) | 2476 f = getsymbol(x[1]) |
2477 d = defineorder | |
2478 if f == 'present': | |
2479 # 'present(set)' is known to return the argument set with no | |
2480 # modification, so forward the current order to its argument | |
2481 d = order | |
2482 return (op, x[1], _analyze(x[2], d), order) | |
2477 raise ValueError('invalid operator %r' % op) | 2483 raise ValueError('invalid operator %r' % op) |
2478 | 2484 |
2479 def analyze(x, order=defineorder): | 2485 def analyze(x, order=defineorder): |
2480 """Transform raw parsed tree to evaluatable tree which can be fed to | 2486 """Transform raw parsed tree to evaluatable tree which can be fed to |
2481 optimize() or getset() | 2487 optimize() or getset() |