# HG changeset patch # User Yuya Nishihara # Date 2015-04-26 09:27:32 # Node ID 4d1e56b29a91ed80faff801ac550a802e27bf690 # Parent c87b05925054c7c13e1085f8dc346d6262f17747 revset: comment that we can't swap 'or' operands by weight Though the original code did nothing, it tried to optimize the calculation order by weight. But we can't simply swap 'ta' and 'tb' because it would change the order of revisions. For future reference, this patch keeps the modified version of the original code as comment. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2162,8 +2162,10 @@ def optimize(x, small): elif op == 'or': wa, ta = optimize(x[1], False) wb, tb = optimize(x[2], False) - if wb < wa: - wb, wa = wa, wb + # we can't reorder trees by weight because it would change the order. + # ("sort(a + b)" == "sort(b + a)", but "a + b" != "b + a") + # if wb < wa: + # tb, ta = ta, tb return max(wa, wb), (op, ta, tb) elif op == 'not': # Optimize not public() to _notpublic() because we have a fast version