Mercurial > hg-stable
changeset 31142:90fb0193f187
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 18 Feb 2017 17:37:52 +0900 |
parents | 1b065fa21b00 |
children | 0bb3089fe735 |
files | mercurial/smartset.py |
diffstat | 1 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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