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.
--- 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))