<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 11, 2019 at 9:53 AM Pierre-Yves David <<a href="mailto:pierre-yves.david@ens-lyon.org">pierre-yves.david@ens-lyon.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 4/11/19 6:48 PM, Martin von Zweigbergk wrote:<br>
> <br>
> <br>
> On Thu, Apr 11, 2019 at 9:46 AM Pierre-Yves David <br>
> <<a href="mailto:pierre-yves.david@ens-lyon.org" target="_blank">pierre-yves.david@ens-lyon.org</a> <mailto:<a href="mailto:pierre-yves.david@ens-lyon.org" target="_blank">pierre-yves.david@ens-lyon.org</a>>> <br>
> wrote:<br>
> <br>
>     # HG changeset patch<br>
>     # User Pierre-Yves David <<a href="mailto:pierre-yves.david@octobus.net" target="_blank">pierre-yves.david@octobus.net</a><br>
>     <mailto:<a href="mailto:pierre-yves.david@octobus.net" target="_blank">pierre-yves.david@octobus.net</a>>><br>
>     # Date 1555000496 -7200<br>
>     #      Thu Apr 11 18:34:56 2019 +0200<br>
>     # Node ID ca4f233c0f5c4ca5604a53c01216a16d136c69d8<br>
>     # Parent  509a0477b3a6e9f1ea0fe32bfb028c256aada7fa<br>
>     # EXP-Topic fix-2e2699af5649<br>
>     # Available At <a href="https://bitbucket.org/octobus/mercurial-devel/" rel="noreferrer" target="_blank">https://bitbucket.org/octobus/mercurial-devel/</a><br>
>     #              hg pull<br>
>     <a href="https://bitbucket.org/octobus/mercurial-devel/" rel="noreferrer" target="_blank">https://bitbucket.org/octobus/mercurial-devel/</a> -r ca4f233c0f5c<br>
>     match: fix re2 compability broken in 2e2699af5649<br>
> <br>
>     Apparently, the re2 regex matcher return False when no match are found.<br>
> <br>
> <br>
> This is not quite true; we explicitly use a different method on the <br>
> compiled regex when we use re2: <br>
> <a href="https://www.mercurial-scm.org/repo/hg/file/509a0477b3a6/mercurial/match.py#l41" rel="noreferrer" target="_blank">https://www.mercurial-scm.org/repo/hg/file/509a0477b3a6/mercurial/match.py#l41</a><br>
<br>
The point is that the `_rematcher` call returns False instead of None, <br>
breaking regex based matching.<br></blockquote><div><br></div><div>Yes, I understand why it's broken. I just mean that "the re2 regex matcher return False when no match are found" is true, but it's misleading, because it makes it sounds like (to me, at least) like the re2 regex matcher behaves differently.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> <br>
>     So since<br>
>     2e2699af5649 running test on a machine with a re2 install fails in<br>
>     many places.<br>
>     Instead we make the code a bit more general and everything goes back<br>
>     to normal.<br>
> <br>
>     diff --git a/mercurial/match.py b/mercurial/match.py<br>
>     --- a/mercurial/match.py<br>
>     +++ b/mercurial/match.py<br>
>     @@ -1288,7 +1288,7 @@ def _buildregexmatch(kindpats, globsuffi<br>
> <br>
>               if startidx == 0:<br>
>                   matcher = _rematcher(fullregexp)<br>
>     -            func = lambda s: matcher(s) is not None<br>
>     +            func = lambda s: bool(matcher(s))<br>
>               else:<br>
>                   group = regexps[startidx:]<br>
>                   allgroups.append(_joinregexes(group))<br>
> <br>
<br>
-- <br>
Pierre-Yves David<br>
</blockquote></div></div>