[PATCH] revset: allow negative integers to list child revs

Mads Kiilerich mads at kiilerich.com
Mon Oct 6 13:41:58 CDT 2014


On 10/06/2014 07:33 PM, Siddharth Agarwal wrote:
> On 10/04/2014 09:57 AM, 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
>
> I like the idea of having a shorthand for children, 

Yeah, it seems like this really is a shorthand for children(X)?

> but I'm not in favour of the shorthand being to select particular 
> children. I think the shorthand we need is for 'all children' instead.

Yes, it seems about right that the singlerev interpretation of that 
would be the tipmost child.

>
> I might be OK with '^-1' to mean 'all children'.

It could however be confusing that x^n gives a single revision for n = 
0, 1, 2 but a set for n = -1.

The n in x^n designates which options to use. The n in x~n designates 
distance from x. It would thus be more consistent to use x~-1 ... and it 
would also be more that x~-2 should mean children(children(X)).

Any use of negative numbers would also make x^-1 more ambiguous (unless 
precedence is considered). Some other symbol would be nice. The best 
(but not so good) candidates could be something with ! or the ~^ 
combination.

/Mads


More information about the Mercurial-devel mailing list