match: fix re2 compability broken in 2e2699af5649
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 11 Apr 2019 18:34:56 +0200
changeset 42099 bccb322f1496
parent 42098 5753e5949b51
child 42100 b63b8b7ca5fa
match: fix re2 compability broken in 2e2699af5649 When using re2, we call test_match() instead of match() on the compiled regex object. While match() returns a matcher object or None, test_match() returns True or False. 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.
mercurial/match.py
--- a/mercurial/match.py	Wed Apr 10 03:10:53 2019 +0530
+++ b/mercurial/match.py	Thu Apr 11 18:34:56 2019 +0200
@@ -1288,7 +1288,7 @@
 
         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))