Mercurial > hg
changeset 33415:371f59c6a89e
revset: do not compute weight for integer literal argument
In x^n and x~n, n isn't a set expression. There's no need to optimize the
right-hand side.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 08 Jul 2017 12:49:46 +0900 |
parents | 16ed67164002 |
children | 9467d5337292 |
files | mercurial/revsetlang.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revsetlang.py Thu Jul 13 00:35:54 2017 +0900 +++ b/mercurial/revsetlang.py Sat Jul 08 12:49:46 2017 +0900 @@ -476,11 +476,15 @@ o = _optimize(x[1], small) order = x[2] return o[0], (op, o[1], order) - elif op in ('dagrange', 'range', 'parent', 'ancestor'): + elif op in ('dagrange', 'range'): wa, ta = _optimize(x[1], small) wb, tb = _optimize(x[2], small) order = x[3] return wa + wb, (op, ta, tb, order) + elif op in ('parent', 'ancestor'): + w, t = _optimize(x[1], small) + order = x[3] + return w, (op, t, x[2], order) elif op == 'list': ws, ts = zip(*(_optimize(y, small) for y in x[1:])) return sum(ws), (op,) + ts