changeset 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 07d5a503124c
children 642feee29d70
files tests/hghave.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave.py	Sat Jun 17 23:09:47 2017 -0700
+++ b/tests/hghave.py	Thu Jun 15 17:13:23 2017 -0700
@@ -278,6 +278,17 @@
 def has_git():
     return matchoutput('git --version 2>&1', br'^git version')
 
+def getgitversion():
+    m = matchoutput('git --version 2>&1', br'git version (\d+)\.(\d+)')
+    if not m:
+        return (0, 0)
+    return (int(m.group(1)), int(m.group(2)))
+
+@checkvers("git", "git client (with ext::sh support) version >= %s", (1.9,))
+def has_git_range(v):
+    major, minor = v.split('.')[0:2]
+    return getgitversion() >= (int(major), int(minor))
+
 @check("docutils", "Docutils text processing library")
 def has_docutils():
     try: