_firstancestors() is a built-in revset of all ancestors down the p1 line

Alberto Griggio alberto.griggio at gmail.com
Mon Jun 6 08:23:43 UTC 2016


Hello Sietse,

> Dear list,
> 
>> I often think of a bookmark
>> branch's 'mainline' as "all ancestors of this commit, but not
>> ancestors that were brought in by merging". In other words,
>> p1(master), p1(p1(master)), and so on back to the root.
>> [...]
>> Before I set about building this revset myself, does anyone know of an
>> extension that provides it?
> 
> Found it! It's not part of Mercurials public API, but Mercurial
> nonetheless has a  `_firstancestors(...)` revset. Been there since
> 2.2, as far as I can tell. I understand this non-public interface
> comes with no guarantees, but it does exactly what I want, and I shall
> happily use it for as long as it is there.
> 
> Now I see all of a bookmark branch's main commits with a single
> command:
[...]

Thanks for sharing! This is something I've been looking for for a long
time (I have your very same use case). Dear Mercurial developers, is
there any reason why _firstancestors() can't be turned into a "public"
revset?

Alberto




More information about the Mercurial mailing list