# HG changeset patch # User Jun Wu # Date 2017-02-22 00:29:31 # Node ID c962bb6af90965263dd265f73d939cb66688f3d1 # Parent 88203f26ea57627cabd7cf9c4f7843661d6c43ae smartset: preserve istopo for baseset operations This is a follow-up of "smartset: use native set operations as fast paths". It's more correct to just preserve the "istopo" information for "&" and "-" operations, like what filteredset does. diff --git a/mercurial/smartset.py b/mercurial/smartset.py --- a/mercurial/smartset.py +++ b/mercurial/smartset.py @@ -203,6 +203,14 @@ class baseset(abstractsmartset): [[7, 6, 4, 0, 3, 5], [7, 6], [4, 0]] >>> [type(i).__name__ for i in [xs + ys, xs & ys, xs - ys]] ['addset', 'baseset', 'baseset'] + + istopo is preserved across set operations + >>> xs = baseset(set(x), istopo=True) + >>> rs = xs & ys + >>> type(rs).__name__ + 'baseset' + >>> rs._istopo + True """ def __init__(self, data=(), datarepr=None, istopo=False): """ @@ -326,7 +334,8 @@ class baseset(abstractsmartset): # try to use native set operations as fast paths if (type(other) is baseset and '_set' in other.__dict__ and '_set' in self.__dict__ and self._ascending is not None): - s = baseset(data=getattr(self._set, op)(other._set)) + s = baseset(data=getattr(self._set, op)(other._set), + istopo=self._istopo) s._ascending = self._ascending else: s = getattr(super(baseset, self), op)(other)