##// END OF EJS Templates
revset: do not partial-match operator and function names in optimize()...
Yuya Nishihara -
r29898:7203400f default
parent child Browse files
Show More
@@ -2371,7 +2371,7 b' def _optimize(x, small):'
2371 elif op == 'negate':
2371 elif op == 'negate':
2372 s = getstring(x[1], _("can't negate that"))
2372 s = getstring(x[1], _("can't negate that"))
2373 return _optimize(('string', '-' + s), small)
2373 return _optimize(('string', '-' + s), small)
2374 elif op in 'string symbol':
2374 elif op in ('string', 'symbol'):
2375 return smallbonus, x # single revisions are small
2375 return smallbonus, x # single revisions are small
2376 elif op == 'and':
2376 elif op == 'and':
2377 wa, ta = _optimize(x[1], True)
2377 wa, ta = _optimize(x[1], True)
@@ -2434,7 +2434,7 b' def _optimize(x, small):'
2434 return o[0], (op, o[1])
2434 return o[0], (op, o[1])
2435 elif op == 'group':
2435 elif op == 'group':
2436 return _optimize(x[1], small)
2436 return _optimize(x[1], small)
2437 elif op in 'dagrange range parent ancestorspec':
2437 elif op in ('dagrange', 'range', 'parent', 'ancestor'):
2438 wa, ta = _optimize(x[1], small)
2438 wa, ta = _optimize(x[1], small)
2439 wb, tb = _optimize(x[2], small)
2439 wb, tb = _optimize(x[2], small)
2440 return wa + wb, (op, ta, tb)
2440 return wa + wb, (op, ta, tb)
@@ -2447,18 +2447,18 b' def _optimize(x, small):'
2447 elif op == 'func':
2447 elif op == 'func':
2448 f = getsymbol(x[1])
2448 f = getsymbol(x[1])
2449 wa, ta = _optimize(x[2], small)
2449 wa, ta = _optimize(x[2], small)
2450 if f in ("author branch closed date desc file grep keyword "
2450 if f in ('author', 'branch', 'closed', 'date', 'desc', 'file', 'grep',
2451 "outgoing user"):
2451 'keyword', 'outgoing', 'user'):
2452 w = 10 # slow
2452 w = 10 # slow
2453 elif f in "modifies adds removes":
2453 elif f in ('modifies', 'adds', 'removes'):
2454 w = 30 # slower
2454 w = 30 # slower
2455 elif f == "contains":
2455 elif f == "contains":
2456 w = 100 # very slow
2456 w = 100 # very slow
2457 elif f == "ancestor":
2457 elif f == "ancestor":
2458 w = 1 * smallbonus
2458 w = 1 * smallbonus
2459 elif f in "reverse limit first _intlist":
2459 elif f in ('reverse', 'limit', 'first', '_intlist'):
2460 w = 0
2460 w = 0
2461 elif f in "sort":
2461 elif f == "sort":
2462 w = 10 # assume most sorts look at changelog
2462 w = 10 # assume most sorts look at changelog
2463 else:
2463 else:
2464 w = 1
2464 w = 1
General Comments 0
You need to be logged in to leave comments. Login now