smartset: reorder initialization of baseset in more intuitive way
authorYuya Nishihara <yuya@tcha.org>
Sat, 18 Feb 2017 17:37:52 +0900
changeset 31127 90fb0193f187
parent 31126 1b065fa21b00
child 31128 0bb3089fe735
smartset: reorder initialization of baseset in more intuitive way What we want to do is to assign either _set or _list per the given data type.
mercurial/smartset.py
--- a/mercurial/smartset.py	Tue Feb 28 20:23:10 2017 +0100
+++ b/mercurial/smartset.py	Sat Feb 18 17:37:52 2017 +0900
@@ -219,16 +219,14 @@
         """
         self._ascending = None
         self._istopo = istopo
-        if not isinstance(data, list):
-            if isinstance(data, set):
-                self._set = data
-                # set has no order we pick one for stability purpose
-                self._ascending = True
-                # converting set to list has a cost, do it lazily
-                data = None
-            else:
+        if isinstance(data, set):
+            # converting set to list has a cost, do it lazily
+            self._set = data
+            # set has no order we pick one for stability purpose
+            self._ascending = True
+        else:
+            if not isinstance(data, list):
                 data = list(data)
-        if data is not None:
             self._list = data
         self._datarepr = datarepr