comparison mercurial/revset.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 205c47e30a93
children c6c8a52e28c9
comparison
equal deleted inserted replaced
34019:205c47e30a93 34020:37b82485097f
167 yorder = anyorder 167 yorder = anyorder
168 else: 168 else:
169 yorder = followorder 169 yorder = followorder
170 return getset(repo, getset(repo, subset, x, order), y, yorder) 170 return getset(repo, getset(repo, subset, x, order), y, yorder)
171 171
172 def flipandset(repo, subset, y, x, order): 172 def andsmallyset(repo, subset, x, y, order):
173 # 'flipand(y, x)' is equivalent to 'and(x, y)', but faster when y is small 173 # 'andsmally(x, y)' is equivalent to 'and(x, y)', but faster when y is small
174 if order == anyorder: 174 if order == anyorder:
175 yorder = anyorder 175 yorder = anyorder
176 else: 176 else:
177 yorder = followorder 177 yorder = followorder
178 return getset(repo, getset(repo, subset, y, yorder), x, order) 178 return getset(repo, getset(repo, subset, y, yorder), x, order)
2099 "rangepost": rangepost, 2099 "rangepost": rangepost,
2100 "dagrange": dagrange, 2100 "dagrange": dagrange,
2101 "string": stringset, 2101 "string": stringset,
2102 "symbol": stringset, 2102 "symbol": stringset,
2103 "and": andset, 2103 "and": andset,
2104 "flipand": flipandset, 2104 "andsmally": andsmallyset,
2105 "or": orset, 2105 "or": orset,
2106 "not": notset, 2106 "not": notset,
2107 "difference": differenceset, 2107 "difference": differenceset,
2108 "relation": relationset, 2108 "relation": relationset,
2109 "relsubscript": relsubscriptset, 2109 "relsubscript": relsubscriptset,