Updated to set the subversion hooks at creation of the repository.
This commit is contained in:
parent
ad6148cae7
commit
3e9229be5f
29
scripts/svn-post-revprop-change
Normal file
29
scripts/svn-post-revprop-change
Normal file
@ -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"
|
70
scripts/svnpostrevpropchange.php
Normal file
70
scripts/svnpostrevpropchange.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# This file is part of InDefero, an open source project management application.
|
||||||
|
# Copyright (C) 2008-2010 Céondo Ltd and contributors.
|
||||||
|
#
|
||||||
|
# InDefero is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# InDefero is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script allows you to hook into the post-revprop-change action
|
||||||
|
* of your subversion repository. I am using it to perform near real
|
||||||
|
* time backup of the repositories on indefero.net.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require dirname(__FILE__).'/../src/IDF/conf/path.php';
|
||||||
|
require 'Pluf.php';
|
||||||
|
Pluf::start(dirname(__FILE__).'/../src/IDF/conf/idf.php');
|
||||||
|
Pluf_Dispatcher::loadControllers(Pluf::f('idf_views'));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [signal]
|
||||||
|
*
|
||||||
|
* svnpostrevpropchange.php::run
|
||||||
|
*
|
||||||
|
* [sender]
|
||||||
|
*
|
||||||
|
* svnpostrevpropchange.php
|
||||||
|
*
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* This signal allows an application to perform a set of tasks on a
|
||||||
|
* post property revision change of a subversion repository.
|
||||||
|
*
|
||||||
|
* [parameters]
|
||||||
|
*
|
||||||
|
* array('repo_dir' => '/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);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -87,6 +87,36 @@ class IDF_Plugin_SyncSvn
|
|||||||
escapeshellarg($svn_path.'/'.$shortname));
|
escapeshellarg($svn_path.'/'.$shortname));
|
||||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||||
$ll = exec($cmd, $output, $return);
|
$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);
|
return ($return == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user