[PATCH 2 of 6] graphlog: turn getlogrevs() into a generator

Patrick Mézard patrick at mezard.eu
Wed May 23 02:44:04 CDT 2012


Le 22/05/12 21:37, Matt Mackall a écrit :
> On Tue, 2012-05-08 at 22:58 +0200, Patrick Mezard wrote:
>> # HG changeset patch
>> # User Patrick Mezard <patrick at mezard.eu>
>> # Date 1336509824 -7200
>> # Node ID 53db775e252c0f4f7add32b62e08096814d3ab7e
>> # Parent  d30440da7b38c671266ae1734db3921475a63caa
>> graphlog: turn getlogrevs() into a generator
> 
> Queued these first two for default, thanks. Still mulling the rest, I'm
> afraid.

By the way, I am not really attached to the precompute thing. This is just the simplest/less invasive trick I found to "solve" the issue at hand. The fundamental issues are:
- There is no execution context provided to revset functions, which makes caching and rewriting harder to implement.
- Being made of tuples, it is pretty hard to annotate the AST.

Instead of registering closures in rewritten function nodes, I first considered registering the closures in the symbol table and keep them in an evaluation context object, which would be reused by getset() and friends. But symbols are global and it means changing the prototype of a lot of functions and was not ready to do that at that point. Considering this, the @precompute solution is not inelegant, maybe I would replace the decorator with an explicit map listing the precomputing symbols, but that is just a question of how to store this property. Still, I believe having a revset context would be great, consider caching outgoing() results for instance...

--
Patrick Mézard


More information about the Mercurial-devel mailing list