[PATCH] smartset: reorder initialization of baseset in more intuitive way
Martin von Zweigbergk
martinvonz at google.com
Tue Feb 28 21:37:15 UTC 2017
On Sat, Feb 18, 2017 at 5:39 PM, Jun Wu <quark at fb.com> wrote:
> Looks good to me. Thanks for the clean-up!
Yep, looks good. Queued, thanks. And sorry about the delay.
>
> Excerpts from Yuya Nishihara's message of 2017-02-18 18:48:06 +0900:
>> # HG changeset patch
>> # User Yuya Nishihara <yuya at tcha.org>
>> # Date 1487407072 -32400
>> # Sat Feb 18 17:37:52 2017 +0900
>> # Node ID 1ca3469fdd08c0d5d814a4bc359869bc157c7fc9
>> # Parent 3f4bdcfe63e9f1e357187fa728ae0da9d35b3973
>> 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.
>>
>> diff --git a/mercurial/smartset.py b/mercurial/smartset.py
>> --- a/mercurial/smartset.py
>> +++ b/mercurial/smartset.py
>> @@ -166,16 +166,14 @@ class baseset(abstractsmartset):
>> """
>> 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
>>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list