Questions about revset.py

Patrick Mézard patrick at mezard.eu
Wed Apr 11 15:45:05 CDT 2012


Le 11/04/12 18:22, Matt Mackall a écrit :
> On Wed, 2012-04-11 at 10:41 +0200, Patrick Mézard wrote:
>> Le 09/04/12 20:19, Matt Mackall a écrit :
>>> On Sun, 2012-04-08 at 20:12 +0200, Patrick Mézard wrote:
>>>> Le 08/04/12 18:55, Matt Mackall a écrit :
>>>>> On Sun, 2012-04-08 at 11:53 +0200, Patrick Mézard wrote:

[...]

>> I have not analyzed the issue yet, my hunch is loops like:
>>
>>
>> def author(repo, subset, x):
>>     """``author(string)``
>>     Alias for ``user(string)``.
>>     """
>>     # i18n: "author" is a keyword
>>     n = encoding.lower(getstring(x, _("author requires a string")))
>>     return [r for r in subset if n in encoding.lower(repo[r].user())]
> 
>> work much better when subset is in changelog order (which is the whole point of cmdutil.increasing_window_whatever() IIRC).
> 
> Almost certainly.
> 
> Ok. So I take it there's a case where you find it useful to pass
> something other than range(len(repo)) to the matcher?

I did that to handle some subtle behaviour of --follow I eventually discovered when trying to use revsets in log command. You can find more details in the commit messages of patches I posted recently:

  http://selenic.com/pipermail/mercurial-devel/2012-April/039148.html

and

  http://selenic.com/pipermail/mercurial-devel/2012-April/039151.html

It can certainly be rewritten purely with revsets but using revset.match() as a filtering function over different input revisions worked and was closer to the original implementation in cmdutil.py. Anyway, this particular issue does not bother me much, and I have to reorder the revisions myself to avoid the orset() reordering effect.
--
Patrick Mézard


More information about the Mercurial-devel mailing list