changeset 5302:961876838de0

hghave: detect cvs and cvsps availability "cvsps -h" was returning 1 in cygwin, probably because CVSROOT was unset, which does not prevent it to work correctly.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 14 Sep 2007 22:17:53 +0200
parents 166b40c49e4a
children a76c61679b71
files tests/hghave
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave
+++ b/tests/hghave
@@ -11,7 +11,7 @@ import tempfile
 
 tempprefix = 'hg-hghave-'
 
-def matchoutput(cmd, regexp):
+def matchoutput(cmd, regexp, ignorestatus=False):
     """Return True if cmd executes successfully and its output
     is matched by the supplied regular expression.
     """
@@ -19,7 +19,7 @@ def matchoutput(cmd, regexp):
     fh = os.popen(cmd)
     s = fh.read()
     ret = fh.close()
-    return ret is None and r.search(s)
+    return (ignorestatus or ret is None) and r.search(s)
 
 def has_symlink():
     return hasattr(os, "symlink")
@@ -27,6 +27,12 @@ def has_symlink():
 def has_fifo():
     return hasattr(os, "mkfifo")
 
+def has_cvs():
+    return matchoutput('cvs --version 2>&1', r'Concurrent Versions System')
+
+def has_cvsps():
+    return matchoutput('cvsps -h -q 2>&1', r'cvsps version', True)
+
 def has_executablebit():
     fd, path = tempfile.mkstemp(prefix=tempprefix)
     os.close(fd)
@@ -66,6 +72,8 @@ def has_git():
     return matchoutput('git --version 2>&1', r'^git version')
 
 checks = {
+    "cvs": (has_cvs, "cvs client"),
+    "cvsps": (has_cvsps, "cvsps utility"),
     "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
     "execbit": (has_executablebit, "executable bit"),
     "git": (has_git, "git command line client"),