Reputation: 639
Is there an easier way to show only active branch heads in Mercurial? So far I've came up with the following alias, which seems to work well:
alias ahead='hg head $(hg branches -aq | xargs)'
(--active, --quiet)
The problem is that hg head[s]
on my version (2.6.1) -- or any, according to the docs -- doesn't have the -a
switch implemented, whereas hg branches
does. I was manually closing a lot of old branches marked inactive without topological heads, which takes ages (although it's probably not too difficult to automate). With the above alias, all those ancient heads are filtered to reduce the noise.
Upvotes: 1
Views: 479
Reputation: 3276
You can build that using hg revsets like this:
hg log -r "heads(all()) and not parents(merge()) and not closed()"
which returns all heads that have not been merged into another branch and are not closed.
You can alias that just like you did before:
alias ahead='hg log -r "heads(all()) and not parents(merge()) and not closed()"'
Upvotes: 2