diff mercurial/util.py @ 50689:a45460e235a2 stable

re2: fix reporting of availability in `hg debuginstall` We add and use an official API to check is re2 is available. This prevent the bug previously in place were debuginstall was considering confusing `None` (i.e. non-initialized) and `False` (i.e. unavailable).
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 17 Jun 2023 04:05:53 +0200
parents 293e1763982e
children a2df74853f8d
line wrap: on
line diff
--- a/mercurial/util.py	Sat Jun 17 04:05:18 2023 +0200
+++ b/mercurial/util.py	Sat Jun 17 04:05:53 2023 +0200
@@ -2210,6 +2210,13 @@
     _re2 = False
 
 
+def has_re2():
+    """return True is re2 is available, False otherwise"""
+    if _re2 is None:
+        _re._checkre2()
+    return _re2
+
+
 class _re:
     @staticmethod
     def _checkre2():