Mercurial > hg
diff tests/hghave @ 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 | 9400d677efc7 |
line wrap: on
line diff
--- a/tests/hghave Mon Aug 27 22:17:51 2007 +0200 +++ b/tests/hghave Fri Sep 14 22:17:53 2007 +0200 @@ -11,7 +11,7 @@ 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 @@ 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_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 @@ 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"),