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

Yuya Nishihara yuya at tcha.org
Tue Jan 17 08:40:39 EST 2017


On Mon, 16 Jan 2017 16:05:48 +0100, Denis Laxalde wrote:
> 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)?

That could be. I'm not sure which is better.

There are several pairs of functions that walk towards opposite directions,
e.g. ancestors()-descendants(), parents()-children(), precursors()-successors(),
so a separate followlines() function makes some sense. But I can't think of a
verb which means tracking changes to future direction.


More information about the Mercurial-devel mailing list