Hg- Find heads not merged into branch

Sam RuebySoftware Development Leave a Comment

I participate in an open source project that utilizes hg (Mercurial), which has a few contributors working in parallel. The way this project works is there are two named branches in a repository. One named branch is the release branch- it’s the source that’s actually built. The other branch contains the parallel changes, which has several heads all based-on the most recent “canonical” head (the head they’re merged into when they’ve passed the review process). This repository is rather large and sometimes heads don’t get merged into the canonical head for a long time, but we still want them in the release branch.

I wanted to be able to find all of the heads that are not in the release branch. I’m a user of TortoiseHg, and even though the graph is helpful, it’s difficult to see where the heads are. I Googled around for this and couldn’t find exactly what I wanted, so below is the revset command I came up with to show me the loose heads.

head() & !ancestors(release)