Reputation: 24947
How do I find all branch heads not merged into the default
branch or any other branch?
1----2----4----6----8----13----14 Branch: default (E is a merge of F into D)
\ \ \ \ / /
\ \ \ 7 / Branch B1 (closed-merged)
\ \ 5-----9---+ Branch B2 (closed-merged)
15 \ \ Branch B5
\ 10 Branch B3
3 \ Branch B4
\ 11 Branch B3
12 Branch B4
In the above example (adapted from this SO answer), I am trying to construct a search that will return changesets 11
,12
and 15
and the name of the branches (Branch B3
,Branch B4
and Branch B5
) as branches not merged into default
.
I would also expect a result of changesets 12
,11
,9
,7
and 14
when compared to Branch 5
Upvotes: 0
Views: 67
Reputation: 28405
95% of what you are asking for is provided with just:
hg heads
The only thing I can see wrong with it is that it does include the trunk tip, 14 in your example.
Upvotes: 0
Reputation: 3276
Using revsets you can accomplish it like this:
hg log -r 'not ancestors(14) and head()'
That should give you the changesets 11, 12, and 15. If you replaced 14 with 15, you should get the set you expect. To also exclude closed branches (7 and 9 in your example), you can add and not closed()
to the revset definition:
hg log -r 'not ancestors(14) and head() and not closed()'
See more about revsets on hg's help pages.
Upvotes: 1