changeset 21870:dd716807fd23

revset: maintain ordering when subtracting from a baseset (issue4289)
author Matt Mackall <mpm@selenic.com>
date Mon, 14 Jul 2014 17:55:31 -0500
parents e353fac7db26
children 0feb41534421
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Jul 15 00:59:09 2014 +0900
+++ b/mercurial/revset.py	Mon Jul 14 17:55:31 2014 -0500
@@ -2243,11 +2243,7 @@
         """Returns a new object with the substraction of the two collections.
 
         This is part of the mandatory API for smartset."""
-        if isinstance(other, baseset):
-            s = other.set()
-        else:
-            s = set(other)
-        return baseset(self.set() - s)
+        return self.filter(lambda x: x not in other)
 
     def __and__(self, other):
         """Returns a new object with the intersection of the two collections.
--- a/tests/test-revset.t	Tue Jul 15 00:59:09 2014 +0900
+++ b/tests/test-revset.t	Mon Jul 14 17:55:31 2014 -0500
@@ -1008,6 +1008,11 @@
   $ log 'min(1 or 2) and not 1'
   $ log 'last(1 or 2, 1) and not 2'
 
+issue4289 - ordering of built-ins
+  $ hg log -M -q -r 3:2
+  3:8528aa5637f2
+  2:5ed5505e9f1c
+
 test revsets started with 40-chars hash (issue3669)
 
   $ ISSUE3669_TIP=`hg tip --template '{node}'`