Is there an extension with a revset for 'all ancestors along the p1 line'?

Sietse Brouwer sbbrouwer at gmail.com
Sun Jun 5 10:08:10 UTC 2016


On 04/06/2016, Scott Palmer <swpalmer at gmail.com> wrote:
> Wouldn’t something like this work:
>
> hg log -r “ancestors(my_bookmark) and not ancestors(@) and not merge()"
>

That works some of the time: it works when my_bookmark is not included
in the ancestors of @/master/default, but it fails when the branch was
already merged in.

In general the challenge boils down to this: "use revsets to find
Changeset X in the diagram below with 'master' and 'my_feature' as the
only user-supplied arguments". As soon as other branches get merged
into master, there are a whole bunch of commits that are ancestors of
master and not descendants of my_feature, and X gets increasingly hard
to find.

With _firstancestors, you can identify a branch's own commits in
isolation of the commits that were merged into it, and everything
becomes a lot easier. X, for example, is the last main commit of
master that is not a descendant of my_feature:
'last(_firstancestors(master) and not descendants(my_feature))'.

o 3 [master] merge into master
|\
o | 2 <-- X
| |I can differentiate
| o 1 [my_feature]

(Mercurial's named branches would make things even easier. The trouble
is that my colleagues were already using Git, so I spent most of my
time with Git remotes and bookmark-based branches.)

Cheers,
Sietse



More information about the Mercurial mailing list