[PATCH] revset: introduce optional 'while' predicate for ancestors()
pierre-yves.david at ens-lyon.org
Fri Oct 10 19:41:37 CDT 2014
On 10/10/2014 07:12 AM, Mads Kiilerich wrote:
> On 10/08/2014 03:27 AM, Pierre-Yves David wrote:
>> On 10/07/2014 05:22 PM, Mads Kiilerich wrote:
>>> # HG changeset patch
>>> # User Mads Kiilerich <madski at unity3d.com>
>>> # Date 1412727753 -7200
>>> # Wed Oct 08 02:22:33 2014 +0200
>>> # Node ID 7c48c97a07b865c86a75562f94656a64a8506273
>>> # Parent 564ae7d2ec9bee86b00a6ba817271ac0b19deca7
>>> revset: introduce optional 'while' predicate for ancestors()
>>> When specifying a 'while' set, ancestors() will now only visit
>>> parents that are
>>> in that set. This makes it possible to prune while doing an ancestor
>>> and reduce the number of membership tests. Such a pruning is very
>>> when expensive checks are involved.
>>> The primary initial use case for this feature is that filtering on
>>> branch name
>>> is so expensive. Often it is just as relevant to prune everything not
>>> on the
>> Feature seems interresting. However ther is a massive refactoring on
>> revset in progress. I'll look at the patch after the end of the
>> refactoring landed (opfully tomorrow).
> Any news on this ... or general thoughts on it from others?
> Do you guys agree such ancestor pruning is relevant? Can you imagine
> other kinds of pruning than when yielding ancestors?
Could be useful for descendant too. Seems related to `only()` so maybe
the implementation could be joined or something. Seems also related to X::Y.
> Some related queries could be max(::.&branch(default)) or
In this case, the code is already doing the right thing (iterating from
> but I assume the optimizer should be able to
> figure out it has iterate in the right order and 'prune' after finding
> the first match.
Not really related to the optimiser. But yes, we lazily find the first
element and drop the rest.
> Expressions with heads() and roots() are more tricky to optimize
> optimatically but should also be possible without special syntax /
> function parameters.
Heads() and roots() are a different kind of hell since you have to
account for holes in your set.
I'm very happy to see you poking at revset ☺
More information about the Mercurial-devel