[PATCH "FIX-RE2] match: fix re2 compability broken in 2e2699af5649

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Apr 11 12:46:49 EDT 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1555000496 -7200
#      Thu Apr 11 18:34:56 2019 +0200
# Node ID ca4f233c0f5c4ca5604a53c01216a16d136c69d8
# Parent  509a0477b3a6e9f1ea0fe32bfb028c256aada7fa
# EXP-Topic fix-2e2699af5649
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r ca4f233c0f5c
match: fix re2 compability broken in 2e2699af5649

Apparently, the re2 regex matcher return False when no match are found. So since
2e2699af5649 running test on a machine with a re2 install fails in many places.
Instead we make the code a bit more general and everything goes back to normal.

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -1288,7 +1288,7 @@ def _buildregexmatch(kindpats, globsuffi
 
         if startidx == 0:
             matcher = _rematcher(fullregexp)
-            func = lambda s: matcher(s) is not None
+            func = lambda s: bool(matcher(s))
         else:
             group = regexps[startidx:]
             allgroups.append(_joinregexes(group))


More information about the Mercurial-devel mailing list