changeset 28786:69c6e9623bdc

revset: force ascending order for baseset initialized from a set It is possible to initialize a baseset directly from a set object. However, in this case the iteration order was inherited from the set. Set have undefined iteration order (especially cpython and pypy will have different one) so we should not rely on it anywhere. Therefor we declare the baseset "ascending" to enforce a consistent iteration order. The sorting is done lazily by the baseset class and should have no performance impact when it does not matter. This makes test-revset.t pass with pypy.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 04 Apr 2016 17:45:54 -0700
parents 87b89dca669d
children ea86cdcd9b50
files mercurial/revset.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Apr 04 17:45:15 2016 -0700
+++ b/mercurial/revset.py	Mon Apr 04 17:45:54 2016 -0700
@@ -2798,13 +2798,15 @@
         datarepr: a tuple of (format, obj, ...), a function or an object that
                   provides a printable representation of the given data.
         """
+        self._ascending = None
         if not isinstance(data, list):
             if isinstance(data, set):
                 self._set = data
+                # set has no order we pick one for stability purpose
+                self._ascending = True
             data = list(data)
         self._list = data
         self._datarepr = datarepr
-        self._ascending = None
 
     @util.propertycache
     def _set(self):