[PATCH 3 of 3 gca-revset] revset: add a new commonancestorheads method
Sean Farley
sean at farley.io
Tue Jun 26 22:37:23 UTC 2018
Yuya Nishihara <yuya at tcha.org> writes:
> On Fri, 15 Jun 2018 11:19:47 -0700, Sean Farley wrote:
>> >> # HG changeset patch
>> >> # User Sean Farley <sean at farley.io>
>> >> # Date 1527357855 -7200
>> >> # Sat May 26 20:04:15 2018 +0200
>> >> # Branch gca-revset
>> >> # Node ID d44266127f1a86af521df2b2c088528c3f3b803a
>> >> # Parent ab29cfd39f48432d8e7c38cdceb62980d5c22f09
>> >> revset: add a new commonancestorheads method
>
>> >> + $ hg log -r 'commonancestorheads(head())'
>> >> + changeset: 1:0f6b37dbe527
>> >> + user: test
>> >> + date: Thu Jan 01 00:00:00 1970 +0000
>> >> + summary: 1 first change f1
>> >> +
>> >> + changeset: 2:d1d156401c1b
>> >> + parent: 0:40494bf2444c
>> >> + user: test
>> >> + date: Thu Jan 01 00:00:00 1970 +0000
>> >> + summary: 2 first change f2
>> >
>> > Can you add a test for variable number (0, 1, 2...) of arguments? I think
>> > that's likely to regress.
>>
>> Ah, yeah, sure.
>>
>> Further discussion: should introduce this new revset and deprecate the
>> older one?
>
> Deprecate which?
Nevermind, I was confused.
>> Or would it be possible to optimize the heads(::x and ::y)
>> syntax? Thoughts?
>
> For trivial case where x and y are symbols, that's possible. But we can't
> rewrite heads(::head()) to commonancestorheads(head()) since ::(x + y) means
> any ancestors of x or y. That's why I said we would need new function anyway.
>
> If we don't like the commonancestorheads() function, maybe we can add
> commonancestors(x) and rewrite heads(commonancestors(x)) to
> _commonancestorsheads(x).
Dammit, Yuya, you are a genius. I wish I was half as smart. A new
serious is incoming.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20180626/d5af422d/attachment.asc>
More information about the Mercurial-devel
mailing list