Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find changeset using commit message mercurial

I was wondering if I can find, in mercurial, a changeset using a part of a commit message

for example I have some commits with following messages: "Test-254 modified some files" "Test-256 added logs"

And I want to find the changeset which has a commit containing Test-254 or Test-256

like image 885
user3656576 Avatar asked Dec 05 '17 13:12

user3656576


1 Answers

Mercurial supports advanced selection language called revset. You can access the help with hg help revset.

It supports both predicates and operators.

Predicates are for example all() to match all revision or desc(string) to match revisions containing string in their message.

Operators are x:y for selecting a range or or for an or condition.

By combining both, you can select the right commits you want:

  • hg log -r "desc('Test-254')" will matches all revision that includes Test-254 in their message.

  • hg log -r "desc('Test-256')" will matches all revision that includes Test-256 in their message.

  • hg log -r "desc('Test-254') or desc('Test-256')" will matches all revision that includes either Test-254 or Test-256 in their message.

like image 149
Boris Feld Avatar answered Oct 06 '22 23:10

Boris Feld