Mercurial > hg
diff mercurial/filesetlang.py @ 38864:73731fa8d1bd
fileset: reorder 'or' expression by weight
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 21 Jul 2018 17:13:34 +0900 |
parents | 61ab546b71c3 |
children | 899b4c74209c |
line wrap: on
line diff
--- a/mercurial/filesetlang.py Sat Aug 04 17:08:33 2018 +0900 +++ b/mercurial/filesetlang.py Sat Jul 21 17:13:34 2018 +0900 @@ -207,6 +207,8 @@ return wb, _optimizeandops(op, tb, ta) if op == 'or': ws, ts = zip(*(_optimize(y) for y in x[1:])) + ts = tuple(it[1] for it in sorted(enumerate(ts), + key=lambda it: ws[it[0]])) return max(ws), (op,) + ts if op == 'list': ws, ts = zip(*(_optimize(y) for y in x[1:]))