How do I list all unmerged branches?

That is, I want a list of all branches that are not closed, and their head is not merged into some other branch.

2 Answers

You can use the branches command

hg branches --active

Branches are considered active if their last commit has not been merged into another branch. Closed branches won't appear in the output at all.

If you need to handle the list programmatically, and can use .NET, there is also a Mercurial .NET library that can make this easy.

1

According to this should work:

hg log -r "head()-parents(merge())-closed()-tag(tip)" --template "{branch}\n"

The corresponding TortoiseHg filter is

head() and not closed() and not parents(merge()) and not tag(tip)

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy