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

login
register
mail settings
Submitter Sean Farley
Date June 16, 2017, 4:59 a.m.
Message ID <658fbb62fe6b37fbf2da.1497589175@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/21423/
State Changes Requested
Headers show

Comments

Sean Farley - June 16, 2017, 4:59 a.m.
# HG changeset patch
# User Sean Farley <sean@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.
Yuya Nishihara - June 16, 2017, 1:37 p.m.
On Thu, 15 Jun 2017 21:59:35 -0700, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean@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

> 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

packaging isn't the standard library. Perhaps it wouldn't be difficult to
reinvent packaging.version.parse().
Sean Farley - June 16, 2017, 6:24 p.m.
Yuya Nishihara <yuya@tcha.org> writes:

> On Thu, 15 Jun 2017 21:59:35 -0700, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean@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
>
>> 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
>
> packaging isn't the standard library. Perhaps it wouldn't be difficult to
> reinvent packaging.version.parse().

D'oh. My test for checking this was obviously flawed. I'll spin up a V2
this weekend.

Patch

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')
 
+@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