comparison mercurial/revset.py @ 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 3e53a64345c1
children e967c3b08705
comparison
equal deleted inserted replaced
21869:e353fac7db26 21870:dd716807fd23
2241 2241
2242 def __sub__(self, other): 2242 def __sub__(self, other):
2243 """Returns a new object with the substraction of the two collections. 2243 """Returns a new object with the substraction of the two collections.
2244 2244
2245 This is part of the mandatory API for smartset.""" 2245 This is part of the mandatory API for smartset."""
2246 if isinstance(other, baseset): 2246 return self.filter(lambda x: x not in other)
2247 s = other.set()
2248 else:
2249 s = set(other)
2250 return baseset(self.set() - s)
2251 2247
2252 def __and__(self, other): 2248 def __and__(self, other):
2253 """Returns a new object with the intersection of the two collections. 2249 """Returns a new object with the intersection of the two collections.
2254 2250
2255 This is part of the mandatory API for smartset.""" 2251 This is part of the mandatory API for smartset."""