changeset 50687: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 e7a3611181aa
children 293e1763982e
files mercurial/util.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Mon Jun 12 10:50:00 2023 +0200
+++ b/mercurial/util.py	Sat Jun 17 04:02:25 2023 +0200
@@ -2214,6 +2214,9 @@
     def _checkre2(self):
         global _re2
         global _re2_input
+        if _re2 is not None:
+            # we already have the answer
+            return
 
         check_pattern = br'\[([^\[]+)\]'
         check_input = b'[ui]'