[PATCH 5 of 5] revset: remove hacky sorting in fullreposet.__and__

Martin von Zweigbergk martinvonz at google.com
Fri Jun 24 18:10:17 EDT 2016


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1466804411 25200
#      Fri Jun 24 14:40:11 2016 -0700
# Node ID abcf4b35dbdcee9a721b49ae2bb815a313baec57
# Parent  87950985ede58fc03fb4a207cd45f197f1690cb8
revset: remove hacky sorting in fullreposet.__and__

We don't seem to have any more functions depending on the sorting done
in fullreposte.__and__, so let's remove it and open up for fixing
other bugs caused by it. Specifically, it prevents rangeset() from
doing "subset & r" as it should.

diff -r 87950985ede5 -r abcf4b35dbdc mercurial/revset.py
--- a/mercurial/revset.py	Thu Jun 23 12:37:09 2016 -0700
+++ b/mercurial/revset.py	Fri Jun 24 14:40:11 2016 -0700
@@ -3619,18 +3619,8 @@
             # object.
             other = baseset(other - self._hiddenrevs)
 
-        # XXX As fullreposet is also used as bootstrap, this is wrong.
-        #
-        # With a giveme312() revset returning [3,1,2], this makes
-        #   'hg log -r "giveme312()"' -> 1, 2, 3 (wrong)
-        # We cannot just drop it because other usage still need to sort it:
-        #   'hg log -r "all() and giveme312()"' -> 1, 2, 3 (right)
-        #
-        # There is also some faulty revset implementations that rely on it
-        # (eg: children as of its state in e8075329c5fb)
-        #
-        # When we fix the two points above we can move this into the if clause
-        other.sort(reverse=self.isdescending())
+        # As fullreposet is used as bootstrap, ignore its ordering and take
+        # that of other.
         return other
 
 def prettyformatset(revs):
diff -r 87950985ede5 -r abcf4b35dbdc tests/test-revset.t
--- a/tests/test-revset.t	Thu Jun 23 12:37:09 2016 -0700
+++ b/tests/test-revset.t	Fri Jun 24 14:40:11 2016 -0700
@@ -181,7 +181,7 @@
     ('symbol', '3')
     ('symbol', '6'))
   * set:
-  <baseset+ [3, 5, 6]>
+  <baseset [3, 5, 6]>
   3
   5
   6
@@ -1707,7 +1707,7 @@
       ('symbol', '4')))
   * set:
   <addset
-    <baseset- [1, 3, 5]>,
+    <baseset [5, 3, 1]>,
     <generatorset+>>
   5
   3
@@ -1730,7 +1730,7 @@
   * set:
   <addset+
     <generatorset+>,
-    <baseset- [1, 3, 5]>>
+    <baseset [5, 3, 1]>>
   0
   1
   2


More information about the Mercurial-devel mailing list