Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter for named branches with a partial name match in mercurial?

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?

like image 276
Ege Özcan Avatar asked Feb 05 '14 12:02

Ege Özcan


1 Answers

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-')
like image 179
Peter Westlake Avatar answered Oct 21 '22 02:10

Peter Westlake