[PATCH] revset: rework 'filteredset.last'
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Jun 23 20:06:25 UTC 2015
On 06/23/2015 12:55 PM, Augie Fackler wrote:
> On Tue, Jun 23, 2015 at 10:37 AM, Yuya Nishihara <yuya at tcha.org> wrote:
>> On Mon, 22 Jun 2015 14:57:30 -0700, Pierre-Yves David wrote:
>>> # HG changeset patch
>>> # User Pierre-Yves David <pierre-yves.david at fb.com>
>>> # Date 1435006081 25200
>>> # Mon Jun 22 13:48:01 2015 -0700
>>> # Node ID 5436ea241ec1c12294d7868de6c679d10d333060
>>> # Parent 7fdd1782fc4ee9da87d8af13e806dc9055db2c38
>>> revset: rework 'filteredset.last'
>>>
>>> As 'isascending' and 'isdescending' are method, not attribute. This led 'last()'
>>> to misbehave on some non-ascending filtered set.
>>>
>>> diff --git a/mercurial/revset.py b/mercurial/revset.py
>>> --- a/mercurial/revset.py
>>> +++ b/mercurial/revset.py
>>> @@ -3022,20 +3022,22 @@ class filteredset(abstractsmartset):
>
>>> return x
>>
>> It will fail if self is empty.
>>
>>>>> revset.filteredset(revset.generatorset([])).last()
>> ...
>> UnboundLocalError: local variable 'x' referenced before assignment
>
> Nice catch. Should I drop this patch, or just await a followup?
Just before the loop add
x = None
(please)
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list