[PATCH 1 of 2 fix-old-git] hghave: add git-ext-sh for testing if git understands ext::sh

Sean Farley sean at farley.io
Fri Jun 16 04:59:35 UTC 2017


# HG changeset patch
# User Sean Farley <sean at farley.io>
# Date 1497572003 25200
#      Thu Jun 15 17:13:23 2017 -0700
# Branch fix-old-git
# Node ID 658fbb62fe6b37fbf2da80430a291dd37f16eb9a
# Parent  29558247b00eff8c95c7604032b59cfbab34010d
hghave: add git-ext-sh 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.

diff --git a/tests/hghave.py b/tests/hghave.py
index 9423726..3eae1b8 100644
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -1,9 +1,10 @@
 from __future__ import absolute_import
 
 import errno
 import os
+import packaging.version
 import re
 import socket
 import stat
 import subprocess
 import sys
@@ -276,10 +277,18 @@ def has_gettext():
 
 @check("git", "git command line client")
 def has_git():
     return matchoutput('git --version 2>&1', br'^git version')
 
+ at check("git-ext-sh", "git command line client which has ext::sh support")
+def has_git_ext_sh():
+    m = matchoutput('git --version 2>&1', br'git version (\d+\.\d+)')
+    if not m:
+        return False
+    vp = packaging.version.parse
+    return vp(m.group(1)) >= vp("1.9")
+
 @check("docutils", "Docutils text processing library")
 def has_docutils():
     try:
         import docutils.core
         docutils.core.publish_cmdline # silence unused import


More information about the Mercurial-devel mailing list