Messing with PECL::cvsclient

Tweet

Just for the sake of interest, been having a hack with Sara Golemon’s cvsclient extension. Being able to access CVS over HTTP (perhaps for a HTML forms interface for updates or exposing with XML-RPC / SOAP) is a very worthwhile aim IMO.

Note that cvsclient is beta (0.2) with only limited functionality so far, for reading a repository and examining the logs for a given file. There’s also next to zero documentation apart from the source.

If you’re running Linux and have the PEAR package manager set up, installing cvsclient as a shared library only requires type “pear install cvsclient-beta” then adding the .so file to your php.ini as an extension. If you’re on Windows… you probably need to beg the owner of this site.

Was able to connect to the WACT CVS repository at Sourceforge like;


$cvs_server = 'cvs.sf.net';
$cvs_root = '/cvsroot/wact';
if ( !$cvs = cvsclient_connect($cvs_server,$cvs_root) ) {
die('Could not connect');
}
echo "Connected to servern";

$cvs_user = 'anonymous';
$cvs_pass = '';
if ( !cvsclient_login($cvs,$cvs_user,$cvs_pass) ) {
die ('Could not login');
}
echo "Logged inn";

Two further functions are exposed to PHP, cvsclient_retrieve() and cvsclient_log(), the former seeming to iterate of the contents of directory in CVS while the latter can be used to fetch the log for a single file e.g.;


$module = 'wact';
$path = '.';
while ($file = cvsclient_retrieve($cvs,$module,$path) ) {
echo $file;
}

and


$file = 'README';
print_r (cvsclient_log($cvs,$module,$file));

Wasn’t able to access directories below the root of the WACT module – whether that’s my fault or a limitation in the current version, I’m not sure. Also there doesn’t seem to be a way to get the filename from cvsclient_retrieve() but. again, I may have missed the point.

Anyway – although it’s not something to put into production right now, it’s definately worth keeping an eye on. Wish the author good luck with it.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • Greg Militello

    While CVS is okay, why not subversion (http://subversion.tigris.org/)? WebDAV is much overlooked, and perhaps much under developed.

    A PHP WebDAV client, now that is what I want.

  • http://www.phppatterns.com HarryF

    WebDAV is much overlooked, and perhaps much under developed.

    A PHP WebDAV client, now that is what I want.

    That’s another interesting “angle of attack”. And there’s some good news…

    http://pear.php.net/package/HTTP_WebDAV_Client
    http://pear.php.net/package/HTTP_WebDAV_Server

    The latest (April) PHP Mag (http://www.phpmag.net/) online edition has an article on them (PHP Mag usually puts the PEAR articles online at a later date).

    I know Subversion has it’s own “plugin” for Apache for providing a WebDav server. So far not played with it (or Subversion) seriously though.

  • wez@php.net

    Don’t beg the wrong people for win32 binaries.
    If you want a PECL extension under windows, ask on pecl-dev@lists.php.net.

    The cvsclient extension is already built for PHP 5 (because the build system is sane) and is available from http://snaps.php.net/win32/PECL_5_0/php_cvsclient.dll

  • video

    I am alse want to find a way to view the file by http_webdav_server class of pear.But I get errors. Why