[PATCH 3 of 3] revset: let followlines also return descendants of startrev

Denis Laxalde denis.laxalde at logilab.fr
Mon Jan 16 10:05:48 EST 2017


Yuya Nishihara a écrit :
> On Mon, 16 Jan 2017 12:03:31 +0100, Denis Laxalde wrote:
>> # HG changeset patch
>> # User Denis Laxalde <denis.laxalde at logilab.fr>
>> # Date 1484555087 -3600
>> #      Mon Jan 16 09:24:47 2017 +0100
>> # Node ID a94f01902574a02c64df58fda3a0ca3398a4c8b8
>> # Parent  69653aeb724d00f3db816670896c2b974c9aa39b
>> # EXP-Topic linerange-log/revset-descendants
>> revset: let followlines also return descendants of startrev
>>
>> This is useful to follow changes in a block of lines forward in the history
>> (for instance, when one wants to find out how a function evolved from a point
>> in history).
>
> I agree it's useful, but I don't think it's good idea to merge these functions
> into one because:
>
>  a) other functions (e.g. ancestors(), descendants(), follow()) don't walk for
>     both directions
>  b) scanning descendants would (probably) double the calculation cost
>  c) we can easily concatenate them by + operator (and define alias as necessary)

These are good points.

About (a), I had another reasoning that followlines() could behave like
other revsets that search in changesets content (like desc() or file())
and which go forward. But other points are probably more important, so
let's go this way.

(In fact, thinking more about it, I'm not sure there's an actual use
case for using followlines in both directions at the same time.)

> Perhaps the heard part would be to give a name to the descending followlines()
> function, but I haven't come up with that. :)
>

Or maybe a keyword argument: followlines(file, fromline:toline, 
descend=True)?


More information about the Mercurial-devel mailing list