# HG changeset patch # User Pierre-Yves David # Date 2019-04-11 16:34:56 # Node ID bccb322f1496e166f63c167b8685c75ea2d3e4b2 # Parent 5753e5949b51e6d9b932f0b2c8240725a79a4084 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. 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))