How to filter for named branches with a partial name match in mercurial?
mercurial, version-control
Solution
You can use regular expressions in the `branch` expression. From `hg help revset`:
"branch(string or set)"
All changesets belonging to the given branch or the branches of the
given changesets.
If "string" starts with "re:", the remainder of the name is treated as a
regular expression. To match a branch that actually starts with "re:",
use the prefix "literal:".
So to match `fb-` at the beginning of the name:
head() and not closed() and not branch('default') and branch('re:^fb-')
Problem
I use the following search expression to find all the heads which aren't closed in our mercurial repository: ``` head() and not closed() and not branch('default') ``` However, I have a convention to name feature branches as `fb-(target-release)-(feature-name)` and I'd also like to filter for the named branches which contain `fb` at the beginning of their name. Is this possible without piping the output to another application?