[PATCH] revset: allow negative integers to list child revs
Sean Farley
sean.michael.farley at gmail.com
Mon Oct 6 12:24:45 CDT 2014
Mads Kiilerich writes:
> On 10/04/2014 06:57 PM, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean.michael.farley at gmail.com>
>> # Date 1412441841 25200
>> # Sat Oct 04 09:57:21 2014 -0700
>> # Node ID c3bd6d6457bf42d2fbcaba89cf0418a0d0604239
>> # Parent 78c916f24dd99a56e4c29153a5df3bd7d1c40edd
>> revset: allow negative integers to list child revs
>>
>> With the heavy use of changeset evolution, it often becomes convenient (read:
>> necessary) to refer to a child revset easily.
>
> "child revset"? "refer to children in revsets"?
Whoops, yes, I meant children of a changeset.
> Is that "children" in the normal sense, where all the changesets that
> have X as parent are children of X?
Yes.
> Can you say more about the use case for this? When do you know that it
> is the 4th and not the 3rd child you want?
This comes up very frequently in evolve where you easily have a parent
of a commit and no easy way (revset way) to refer to the child.
> Is it finding the n'th child found among immediate children in some
> ordering, or is it iteratively taking the "best" child? (That (and the
> ordering) should be clarified in patch description and documentation.)
Good question. The ordering is given by changelog.children. It would
seem to be the revision number order. Thoughts on putting a (documented)
order on this?
> (Assuming it is following a chain of "first child", it would be more
> consistent if it was like X~-2. The common case in a DAG is to have only
> one ancestor, and a chain of "first ancestors" is thus usually quite
> obvious and well defined (and usually converging if it is ambiguous). I
> think it is less obvious what "chain of first child" would be ... and it
> would be more fragile.)
I haven't thought of a good way to do this. With this patch, X^-2 refers
to the second child (for now, we won't worry about order). X^-50 would
be the 50th child. X~-50 would be ... the 50th first child? I don't know.
More information about the Mercurial-devel
mailing list