# HG changeset patch # User Jun Wu # Date 1487723371 28800 # 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 -r 88203f26ea57 -r c962bb6af909 mercurial/smartset.py --- a/mercurial/smartset.py Tue Feb 07 17:13:25 2017 -0500 +++ b/mercurial/smartset.py Tue Feb 21 16:29:31 2017 -0800 @@ -203,6 +203,14 @@ [[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 @@ # 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)