changeset 44465:75ada5fe9b62

hghave: add a `rust` keyword to detect the use of compiled rust code The content of some on disk cache can varies when using rust (because it is faster to do so in the rust variant). So we need to be able to detect this case for some test. Differential Revision: https://phab.mercurial-scm.org/D8162
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 18 Feb 2020 18:32:31 +0100
parents 23df5ecfa365
children 79ac59d3f73d
files tests/hghave.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Fri Feb 28 14:34:37 2020 +0100
+++ b/tests/hghave.py	Tue Feb 18 18:32:31 2020 +0100
@@ -332,6 +332,17 @@
     return gethgversion() >= (int(major), int(minor))
 
 
+@check("rust", "Using the Rust extensions")
+def has_rust():
+    """Check is the mercurial currently running is using some rust code"""
+    cmd = b'hg debuginstall --quiet 2>&1'
+    match = br'checking module policy \(([^)]+)\)'
+    policy = matchoutput(cmd, match)
+    if not policy:
+        return False
+    return b'rust' in policy.group(1)
+
+
 @check("hg08", "Mercurial >= 0.8")
 def has_hg08():
     if checks["hg09"][0]():