comparison mercurial/revsetlang.py @ 34020:37b82485097f

revset: do not flip "and" arguments when optimizing Rewrite `flipand(y, x)` to `andsmally(x, y)` so the AST order is unchanged, which could be more friendly to developers. Differential Revision: https://phab.mercurial-scm.org/D579
author Jun Wu <quark@fb.com>
date Wed, 30 Aug 2017 16:05:12 -0700
parents 96f249dce03e
children b862e6fca7ac
comparison
equal deleted inserted replaced
34019:205c47e30a93 34020:37b82485097f
372 return w, ('func', ('symbol', 'only'), tm) 372 return w, ('func', ('symbol', 'only'), tm)
373 373
374 if tb is not None and tb[0] == 'not': 374 if tb is not None and tb[0] == 'not':
375 return wa, ('difference', ta, tb[1]) 375 return wa, ('difference', ta, tb[1])
376 if wa > wb: 376 if wa > wb:
377 return w, ('flipand', tb, ta) 377 op = 'andsmally'
378 return w, (op, ta, tb) 378 return w, (op, ta, tb)
379 elif op == 'or': 379 elif op == 'or':
380 # fast path for machine-generated expression, that is likely to have 380 # fast path for machine-generated expression, that is likely to have
381 # lots of trivial revisions: 'a + b + c()' to '_list(a b) + c()' 381 # lots of trivial revisions: 'a + b + c()' to '_list(a b) + c()'
382 ws, ts, ss = [], [], [] 382 ws, ts, ss = [], [], []