tests/hghave.py
changeset 28761 be13a0fb84e8
parent 28760 cef86c3c82d2
child 28779 0970ebec29b4
equal deleted inserted replaced
28760:cef86c3c82d2 28761:be13a0fb84e8
   223         import _lsprof
   223         import _lsprof
   224         _lsprof.Profiler # silence unused import warning
   224         _lsprof.Profiler # silence unused import warning
   225         return True
   225         return True
   226     except ImportError:
   226     except ImportError:
   227         return False
   227         return False
       
   228 
       
   229 def gethgversion():
       
   230     m = matchoutput('hg --version --quiet 2>&1', r'(\d+)\.(\d+)')
       
   231     if not m:
       
   232         return (0, 0)
       
   233     return (int(m.group(1)), int(m.group(2)))
       
   234 
       
   235 @checkvers("hg", "Mercurial >= %s",
       
   236             list([(1.0 * x) / 10 for x in range(9, 40)]))
       
   237 def has_hg_range(v):
       
   238     major, minor = v.split('.')[0:2]
       
   239     return gethgversion() >= (int(major), int(minor))
       
   240 
       
   241 @check("hg08", "Mercurial >= 0.8")
       
   242 def has_hg08():
       
   243     if checks["hg09"][0]():
       
   244         return True
       
   245     return matchoutput('hg help annotate 2>&1', '--date')
       
   246 
       
   247 @check("hg07", "Mercurial >= 0.7")
       
   248 def has_hg07():
       
   249     if checks["hg08"][0]():
       
   250         return True
       
   251     return matchoutput('hg --version --quiet 2>&1', 'Mercurial Distributed SCM')
       
   252 
       
   253 @check("hg06", "Mercurial >= 0.6")
       
   254 def has_hg06():
       
   255     if checks["hg07"][0]():
       
   256         return True
       
   257     return matchoutput('hg --version --quiet 2>&1', 'Mercurial version')
   228 
   258 
   229 @check("gettext", "GNU Gettext (msgfmt)")
   259 @check("gettext", "GNU Gettext (msgfmt)")
   230 def has_gettext():
   260 def has_gettext():
   231     return matchoutput('msgfmt --version', 'GNU gettext-tools')
   261     return matchoutput('msgfmt --version', 'GNU gettext-tools')
   232 
   262