[PATCH] revset: rework 'filteredset.last'

Augie Fackler raf at durin42.com
Tue Jun 23 14:55:29 CDT 2015


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?

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list