Mercurial > hg-stable
comparison mercurial/util.py @ 50396:82cf392c99f6 stable
re2: exit `_checkre2` early if calling it is useless
If we already know if re2 is supported there is no need to run the check again.
Stricly speaking we don't call it twice, but this seems a simple enough
safeguard to include in this series.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 17 Jun 2023 04:02:25 +0200 |
parents | ffeeaeb2d142 |
children | 293e1763982e |
comparison
equal
deleted
inserted
replaced
50395:e7a3611181aa | 50396:82cf392c99f6 |
---|---|
2212 | 2212 |
2213 class _re: | 2213 class _re: |
2214 def _checkre2(self): | 2214 def _checkre2(self): |
2215 global _re2 | 2215 global _re2 |
2216 global _re2_input | 2216 global _re2_input |
2217 if _re2 is not None: | |
2218 # we already have the answer | |
2219 return | |
2217 | 2220 |
2218 check_pattern = br'\[([^\[]+)\]' | 2221 check_pattern = br'\[([^\[]+)\]' |
2219 check_input = b'[ui]' | 2222 check_input = b'[ui]' |
2220 try: | 2223 try: |
2221 # check if match works, see issue3964 | 2224 # check if match works, see issue3964 |