comparison tests/hghave.py @ 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 e397c6d74652
children 2e464925f662
comparison
equal deleted inserted replaced
44464:23df5ecfa365 44465:75ada5fe9b62
328 "hg", "Mercurial >= %s", list([(1.0 * x) / 10 for x in range(9, 99)]) 328 "hg", "Mercurial >= %s", list([(1.0 * x) / 10 for x in range(9, 99)])
329 ) 329 )
330 def has_hg_range(v): 330 def has_hg_range(v):
331 major, minor = v.split('.')[0:2] 331 major, minor = v.split('.')[0:2]
332 return gethgversion() >= (int(major), int(minor)) 332 return gethgversion() >= (int(major), int(minor))
333
334
335 @check("rust", "Using the Rust extensions")
336 def has_rust():
337 """Check is the mercurial currently running is using some rust code"""
338 cmd = b'hg debuginstall --quiet 2>&1'
339 match = br'checking module policy \(([^)]+)\)'
340 policy = matchoutput(cmd, match)
341 if not policy:
342 return False
343 return b'rust' in policy.group(1)
333 344
334 345
335 @check("hg08", "Mercurial >= 0.8") 346 @check("hg08", "Mercurial >= 0.8")
336 def has_hg08(): 347 def has_hg08():
337 if checks["hg09"][0](): 348 if checks["hg09"][0]():