# HG changeset patch # User Pierre-Yves David # Date 2014-10-09 11:24:51 # Node ID 546fa657681544eef155c15756a4757e610d506e # Parent 1dd178277cf5069c16237d41510f1f0e8dbe0383 revset: restore order of `or` operation as in Mercurial 2.9 Lazy revset broke the ordering of the `or` revset. We now stop assuming that two ascending revset are combine into an ascending one. Behavior in 3.0: 3:4 or 2:5 == [2, 3, 4, 5] Behavior in 2.9: 3:4 or 2:5 == [3, 4, 2, 5] We are adding a test for it. For unclear reason, the performance `or` revset with expensive filter are getting even worse than they used to be. This is probably caused by extra uncached containment check or iteration. revset #9: author(lmoscovicz) or author(mpm) before) wall 3.487583 comb 3.490000 user 3.490000 sys 0.000000 (best of 3) after) wall 4.481486 comb 4.480000 user 4.470000 sys 0.010000 (best of 3) revset #10: author(mpm) or author(lmoscovicz) before) wall 3.164839 comb 3.170000 user 3.160000 sys 0.010000 (best of 3) after) wall 4.574965 comb 4.570000 user 4.570000 sys 0.000000 (best of 3) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2283,12 +2283,7 @@ class abstractsmartset(object): """Returns a new object with the union of the two collections. This is part of the mandatory API for smartset.""" - kwargs = {} - if self.isascending() and other.isascending(): - kwargs['ascending'] = True - if self.isdescending() and other.isdescending(): - kwargs['ascending'] = False - return addset(self, other, **kwargs) + return addset(self, other) def __sub__(self, other): """Returns a new object with the substraction of the two collections. diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -572,6 +572,29 @@ test intersecting something with an adds 5 8 +test that `or` operation combines elements in the right order: + + $ log '3:4 or 2:5' + 3 + 4 + 2 + 5 + $ log '3:4 or 5:2' + 3 + 4 + 5 + 2 + $ log 'sort(3:4 or 2:5)' + 2 + 3 + 4 + 5 + $ log 'sort(3:4 or 5:2)' + 2 + 3 + 4 + 5 + check that conversion to only works $ try --optimize '::3 - ::1' (minus