Mercurial > hg
comparison tests/hghave.py @ 32901:559db66dead5
hghave: add has_git_range for testing if git understands ext::sh
Even on CentOS 7, git is at version 1.8. It seems git 1.9 is when
ext::sh was introduced so we a check for that. The way these functions
are written follows the same style and format for the way we check svn
and bzr versions.
author | Sean Farley <sean@farley.io> |
---|---|
date | Thu, 15 Jun 2017 17:13:23 -0700 |
parents | 41f99a90675d |
children | c384ac3ea147 |
comparison
equal
deleted
inserted
replaced
32900:07d5a503124c | 32901:559db66dead5 |
---|---|
275 return matchoutput('msgfmt --version', br'GNU gettext-tools') | 275 return matchoutput('msgfmt --version', br'GNU gettext-tools') |
276 | 276 |
277 @check("git", "git command line client") | 277 @check("git", "git command line client") |
278 def has_git(): | 278 def has_git(): |
279 return matchoutput('git --version 2>&1', br'^git version') | 279 return matchoutput('git --version 2>&1', br'^git version') |
280 | |
281 def getgitversion(): | |
282 m = matchoutput('git --version 2>&1', br'git version (\d+)\.(\d+)') | |
283 if not m: | |
284 return (0, 0) | |
285 return (int(m.group(1)), int(m.group(2))) | |
286 | |
287 @checkvers("git", "git client (with ext::sh support) version >= %s", (1.9,)) | |
288 def has_git_range(v): | |
289 major, minor = v.split('.')[0:2] | |
290 return getgitversion() >= (int(major), int(minor)) | |
280 | 291 |
281 @check("docutils", "Docutils text processing library") | 292 @check("docutils", "Docutils text processing library") |
282 def has_docutils(): | 293 def has_docutils(): |
283 try: | 294 try: |
284 import docutils.core | 295 import docutils.core |