diff --git a/scripts/svn-post-revprop-change b/scripts/svn-post-revprop-change new file mode 100644 index 0000000..5949556 --- /dev/null +++ b/scripts/svn-post-revprop-change @@ -0,0 +1,29 @@ +#!/bin/sh +# +# This hook does only one thing: +# +# 1. It calls the svnpostrevpropchange.php script with the current repository +# and revision as argument. The svnpostrevpropchange.php script will then +# trigger the 'svnpostrevpropchange.php::run' event with the repository +# path, revision, username, property name and action as arguments together +# with merged $_ENV and $_SERVER array. +# +# This hook is normally installed automatically at the creation of your +# repository if you have everything configured correctly. If you want +# to enable it later, you need to symlink it as "post-revprop-change" in your +# $REPOSITORY/hooks folder. It needs to be executable. +# +# www$ chmod +x /home/www/indefero/scripts/svn-post-revprop-change +# www$ cd /home/svn/repositories/project/hooks +# www$ ln -s /home/www/indefero/scripts/svn-post-revprop-change post-revprop-change +# + +SCRIPTDIR=$(dirname $(readlink -f $0)) +PHP_POST_REVPROP=$SCRIPTDIR/svnpostrevpropchange.php + +echo php $PHP_POST_REVPROP "$1" "$2" "$3" "$4" "$5" | at now > /dev/null 2>&1 +REPOS="$1" +REV="$2" +USER="$3" +PROPNAME="$4" +ACTION="$5" diff --git a/scripts/svnpostrevpropchange.php b/scripts/svnpostrevpropchange.php new file mode 100644 index 0000000..147c0e5 --- /dev/null +++ b/scripts/svnpostrevpropchange.php @@ -0,0 +1,70 @@ + '/path/to/subversion/repository', + * 'revision' => 1234, + * 'user' => 'username', + * 'propname' => 'changed-property', + * 'action' => 'the action M, A or D', + * 'env' => array_merge($_ENV, $_SERVER)); + * + */ + +$params = array('repo_dir' => $argv[1], + 'revision' => $argv[2], + 'user' => $argv[3], + 'propname' => $argv[4], + 'action' => $argv[5], + 'env' => array_merge($_ENV, $_SERVER)); +Pluf_Signal::send('svnpostrevpropchange.php::run', 'svnpostrevpropchange.php', + $params); + + + diff --git a/src/IDF/Plugin/SyncSvn.php b/src/IDF/Plugin/SyncSvn.php index bfebf51..3b926e8 100644 --- a/src/IDF/Plugin/SyncSvn.php +++ b/src/IDF/Plugin/SyncSvn.php @@ -87,6 +87,36 @@ class IDF_Plugin_SyncSvn escapeshellarg($svn_path.'/'.$shortname)); $cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd; $ll = exec($cmd, $output, $return); + if ($return != 0) { + Pluf_Log::error(array('IDF_Plugin_SyncSvn::processSvnCreate', + 'Error', + array('path' => $svn_path.'/'.$shortname, + 'output' => $output))); + return; + } + $p = realpath(dirname(__FILE__).'/../../../scripts/svn-post-commit'); + exec(sprintf(Pluf::f('idf_exec_cmd_prefix', '').'ln -s %s %s', + escapeshellarg($p), + escapeshellarg($svn_path.'/'.$shortname.'/hooks/post-commit')), + $out, $res); + if ($res != 0) { + Pluf_Log::warn(array('IDF_Plugin_SyncSvn::processSvnCreate', + 'post-commit hook creation error.', + $svn_path.'/'.$shortname.'/hooks/post-commit')); + return; + } + $p = realpath(dirname(__FILE__).'/../../../scripts/svn-post-revprop-change'); + exec(sprintf(Pluf::f('idf_exec_cmd_prefix', '').'ln -s %s %s', + escapeshellarg($p), + escapeshellarg($svn_path.'/'.$shortname.'/hooks/post-revprop-change')), + $out, $res); + if ($res != 0) { + Pluf_Log::warn(array('IDF_Plugin_SyncSvn::processSvnCreate', + 'post-revprop-change hook creation error.', + $svn_path.'/'.$shortname.'/hooks/post-revprop-change')); + return; + } + return ($return == 0); }