It ends up in the JSON method context_commits of merge_requests_controller.rb, which is called by the JavaScript front end and seems to be of interest for MR commit lists.
Basic implementation of commit_message_patterns is easy enough with the grep revset predicate but there are two differences with Gitaly:
it matches the file and user names as well
no support for ignore_case
Given how simple the grep predicate implementation is, we could add our own. Quoting revset.py in Mercurial 6.3.3:
@predicate(b'grep(regex)',weight=10)defgrep(repo,subset,x):"""Like ``keyword(string)`` but accepts a regex. Use ``grep(r'...')`` to ensure special escape characters are handled correctly. Unlike ``keyword(string)``, the match is case-sensitive."""try:# i18n: "grep" is a keywordgr=re.compile(getstring(x,_(b"grep requires a string")))exceptre.errorase:raiseerror.ParseError(_(b'invalid match pattern: %s')%stringutil.forcebytestr(e))defmatches(x):c=repo[x]foreinc.files()+[c.user(),c.description()]:ifgr.search(e):returnTruereturnFalsereturnsubset.filter(matches,condrepr=(b'<grep %r>',gr.pattern))