[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: PHP, Subversion and Hook Scripts

From: Samuel DeVore <sdevore_at_gmail.com>
Date: 2005-03-20 19:55:48 CET

> 1) Can I use PHP as I don't have either PERL or PYTHON installed on my
> system and I don't know either language?
> 2) Are there any further examples of the kind of things these hook scripts
> can do?
> 3) Is there a website with a collection of scripts?
> 4) Has anyone looked at creating a PHP extension module (library) that
> can interface directly to the Subverion libraries?
> 5) Would anyone have any ideas as to how to go about implementing this?

I've played a little with the PEAR library for SVN
but ended up without it, the sample should give you an idea.

Sam D

here is a little sample


require_once 'Console/Getargs.php';
require_once 'Mail.php';
$args =& Console_Getargs::factory();
$mailer =& Mail::factory('mail');
$to = 'comitEmail@example.com';
$headers = array('Subject'=>'[SVN-Com] '.$argv[1]."
$body =array();
exec('/usr/local/bin/svnlook info /svn/uscRep',$info);

exec('/usr/local/bin/svnlook changed /svn/uscRep',$files);

$body = array_merge($body,$argv);
$s = "SVN Post-commit Email\n";
$s .= "=====================\n";
$s .= "User: ".$info[0]."\n";
$s .= "Time: ".$info[1]."\n";
$s .= "Repository: ".$argv[1]." Revision #".$argv[2]."\n";

$s .= "\nMessage:\n";
$num = count($info);
for ( $i = 3; $i < $num; $i++ )
   $s .= $info[$i]."\n";
$s .= "=====================\n";
foreach ( $files as $file )
   $s .= $file."\n";

$res = $mailer->send($to,$headers, $s);

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Mar 20 19:58:11 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.