tests/hghave.py
changeset 44279 e48a996d12bc
parent 44264 d3f776c4760e
child 44448 55c443fcb4fc
equal deleted inserted replaced
44277:3245cdea2c63 44279:e48a996d12bc
   305         return True
   305         return True
   306     except ImportError:
   306     except ImportError:
   307         return False
   307         return False
   308 
   308 
   309 
   309 
   310 def gethgversion():
   310 def _gethgversion():
   311     m = matchoutput('hg --version --quiet 2>&1', br'(\d+)\.(\d+)')
   311     m = matchoutput('hg --version --quiet 2>&1', br'(\d+)\.(\d+)')
   312     if not m:
   312     if not m:
   313         return (0, 0)
   313         return (0, 0)
   314     return (int(m.group(1)), int(m.group(2)))
   314     return (int(m.group(1)), int(m.group(2)))
       
   315 
       
   316 
       
   317 _hgversion = None
       
   318 
       
   319 
       
   320 def gethgversion():
       
   321     global _hgversion
       
   322     if _hgversion is None:
       
   323         _hgversion = _gethgversion()
       
   324     return _hgversion
   315 
   325 
   316 
   326 
   317 @checkvers(
   327 @checkvers(
   318     "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)])
   319 )
   329 )