[PATCH] revset: added smartset attribute to new classes to test at mfunc and getset

Lucas Moscovicz lmoscovicz at fb.com
Tue Feb 18 18:37:47 CST 2014



On 2/18/14, 4:25 PM, "Pierre-Yves David" <pierre-yves.david at ens-lyon.org>
wrote:

>
>
>On 02/18/2014 04:13 PM, Lucas Moscovicz wrote:
>> # HG changeset patch
>> # User Lucas Moscovicz <lmoscovicz at fb.com>
>> # Date 1392767686 28800
>> #      Tue Feb 18 15:54:46 2014 -0800
>> # Node ID d9813f85f80e36e413da7bd1b5edd3a2118bc715
>> # Parent  c29948fed40a2d9755ecaa01ec05bfa542f65670
>> revset: added smartset attribute to new classes to test at mfunc and
>>getset
>
>I believe this patch is important.  There is a lots of extension out
>there implementing new revset. We are adding smarter feature which are
>mostly a super set of the old behavior (using list). There is no good
>reason to break the compatibility for our user out there.
>
>I know we do not have a public API but this does not mean we should
>gratuitously break widely used a trivial API. (I could compare that to
>breaking the changectx API for no good reason).
>
>> Now extensions shouldn't break when adding new revsets.
>
>Did you actually test it with old style code?

I just tested it with an extension that used to fail over this same
problem and I had fixed manually.

>
>> diff --git a/mercurial/revset.py b/mercurial/revset.py
>> --- a/mercurial/revset.py
>> +++ b/mercurial/revset.py
>> @@ -195,7 +195,10 @@
>>   def getset(repo, subset, x):
>>       if not x:
>>           raise error.ParseError(_("missing argument"))
>> -    return methods[x[0]](repo, subset, *x[1:])
>> +    s = methods[x[0]](repo, subset, *x[1:])
>> +    if util.safehasattr(s, 'smartset'):
>> +        return s
>
>We can probably just check for the presence of a `set` attribute. as it
>is the most visible addition of the new object.
>
>-- 
>Pierre-Yves



More information about the Mercurial-devel mailing list