mercurial/smartset.py
changeset 31127 90fb0193f187
parent 31066 c962bb6af909
child 31446 9a94239e4f12
equal deleted inserted replaced
31126:1b065fa21b00 31127:90fb0193f187
   217         datarepr: a tuple of (format, obj, ...), a function or an object that
   217         datarepr: a tuple of (format, obj, ...), a function or an object that
   218                   provides a printable representation of the given data.
   218                   provides a printable representation of the given data.
   219         """
   219         """
   220         self._ascending = None
   220         self._ascending = None
   221         self._istopo = istopo
   221         self._istopo = istopo
   222         if not isinstance(data, list):
   222         if isinstance(data, set):
   223             if isinstance(data, set):
   223             # converting set to list has a cost, do it lazily
   224                 self._set = data
   224             self._set = data
   225                 # set has no order we pick one for stability purpose
   225             # set has no order we pick one for stability purpose
   226                 self._ascending = True
   226             self._ascending = True
   227                 # converting set to list has a cost, do it lazily
   227         else:
   228                 data = None
   228             if not isinstance(data, list):
   229             else:
       
   230                 data = list(data)
   229                 data = list(data)
   231         if data is not None:
       
   232             self._list = data
   230             self._list = data
   233         self._datarepr = datarepr
   231         self._datarepr = datarepr
   234 
   232 
   235     @util.propertycache
   233     @util.propertycache
   236     def _set(self):
   234     def _set(self):