comparison mercurial/revsetlang.py @ 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 4672db164c98
children 9467d5337292
comparison
equal deleted inserted replaced
33414:16ed67164002 33415:371f59c6a89e
474 return smallbonus, x 474 return smallbonus, x
475 elif op in ('rangepre', 'rangepost', 'parentpost'): 475 elif op in ('rangepre', 'rangepost', 'parentpost'):
476 o = _optimize(x[1], small) 476 o = _optimize(x[1], small)
477 order = x[2] 477 order = x[2]
478 return o[0], (op, o[1], order) 478 return o[0], (op, o[1], order)
479 elif op in ('dagrange', 'range', 'parent', 'ancestor'): 479 elif op in ('dagrange', 'range'):
480 wa, ta = _optimize(x[1], small) 480 wa, ta = _optimize(x[1], small)
481 wb, tb = _optimize(x[2], small) 481 wb, tb = _optimize(x[2], small)
482 order = x[3] 482 order = x[3]
483 return wa + wb, (op, ta, tb, order) 483 return wa + wb, (op, ta, tb, order)
484 elif op in ('parent', 'ancestor'):
485 w, t = _optimize(x[1], small)
486 order = x[3]
487 return w, (op, t, x[2], order)
484 elif op == 'list': 488 elif op == 'list':
485 ws, ts = zip(*(_optimize(y, small) for y in x[1:])) 489 ws, ts = zip(*(_optimize(y, small) for y in x[1:]))
486 return sum(ws), (op,) + ts 490 return sum(ws), (op,) + ts
487 elif op == 'keyvalue': 491 elif op == 'keyvalue':
488 w, t = _optimize(x[2], small) 492 w, t = _optimize(x[2], small)