Adding scripts

This commit is contained in:
Nathan Adams 2013-07-24 22:47:45 -05:00
parent 3b1e713fc4
commit 7816fa82e9
19 changed files with 804 additions and 0 deletions

View File

@ -0,0 +1,11 @@
#!/bin/sh
private_notify="/home/mercurial/tmp/notify.tmp"
# reload_cmd="/usr/sbin/apachectl -k graceful"
reload_cmd="sudo /etc/init.d/apache2 reload"
if [ -e $private_notify ]; then
rm -f $private_notify
$reload_cmd
fi

View File

@ -0,0 +1,48 @@
<?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-2011 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 recalculates the "project activity" for all of the
* forge's projects for the given date.
* If no date is given, yesterday's date is used.
*
* This script should run once a day. You can configure its behaviour
* with $cfg['activity_section_weights'] and $cfg['activity_lookback'].
*
* If the script runs more than once with the same date argument,
* previously recorded project activity values are replaced with the
* newly created ones.
*/
require dirname(__FILE__).'/../src/IDF/conf/path.php';
require 'Pluf.php';
Pluf::start(dirname(__FILE__).'/../src/IDF/conf/idf.php');
$date = new DateTime('yesterday');
if (count($_SERVER['argv']) > 1) {
$date = new DateTime($_SERVER['argv'][1]);
}
echo 'recalculating project activity for '.$date->format('Y-m-d')."\n";
IDF_ActivityTaxonomy::recalculateTaxnomies($date);

View File

@ -0,0 +1,24 @@
#!/bin/sh
#
# This hook does only one thing:
#
# 1. It calls the gitpostupdate.php script with the current $GIT_DIR
# as argument. The gitpostupdate.php script will then trigger
# the 'gitpostupdate.php::run' event with the $GIT_DIR as argument
# 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-update" in your
# $GIT_DIR/hooks folder.
#
# www$ chmod +x /home/www/indefero/scripts/git-post-update
# git$ cd /home/git/repositories/project.git/hooks
# git$ ln -s /home/www/indefero/scripts/git-post-update post-update
#
SCRIPTDIR=$(dirname $(readlink $0))
FULL_GIT_DIR=$(cd "$GIT_DIR" && /bin/pwd || "$GIT_DIR")
PHP_POST_UPDATE=$SCRIPTDIR/gitpostupdate.php
echo php $PHP_POST_UPDATE $FULL_GIT_DIR | at now > /dev/null 2>&1

View File

@ -0,0 +1,35 @@
<?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-2011 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 is used to sync the SSH keys, mark the repositories for
* export and prune the deleted repositories.
*
*/
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'));
IDF_Plugin_SyncGit_Cron::main();

View File

@ -0,0 +1,59 @@
<?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-2011 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 will send the notifications after a push in your
* repository.
*/
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]
*
* gitpostupdate.php::run
*
* [sender]
*
* gitpostupdate.php
*
* [description]
*
* This signal allows an application to perform a set of tasks on a
* post update of a git repository.
*
* [parameters]
*
* array('git_dir' => '/path/to/git/repository.git',
* 'env' => array_merge($_ENV, $_SERVER));
*
*/
$params = array('git_dir' => $argv[1],
'env' => array_merge($_ENV, $_SERVER));
Pluf_Log::event(array('gitpostupdate.php', 'Send run signal.', $params));
Pluf_Signal::send('gitpostupdate.php::run', 'gitpostupdate.php', $params);

View File

@ -0,0 +1,36 @@
<?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-2011 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 is used to control the access to the git repositories
* using a restricted shell access.
*
* The only argument must be the login of the user.
*/
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'));
IDF_Plugin_SyncGit_Serve::main($argv, array_merge($_SERVER, $_ENV));

View File

@ -0,0 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008-2011 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 ***** */
import os
import sys
import subprocess
SCRIPTDIR = os.path.abspath(__file__).rsplit(os.path.sep, 1)[0]
GITSERVEPHP = '%s/gitserve.php' % SCRIPTDIR
process = subprocess.Popen(['php', GITSERVEPHP, sys.argv[1]],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output = str.encode("\n").join(process.communicate()).strip()
status = process.wait()
if status == 0:
os.execvp('git', ['git', 'shell', '-c', output.strip()])
else:
sys.stderr.write("%s\n" % output.strip())
sys.exit(1)

View File

@ -0,0 +1,64 @@
#!/usr/bin/env php
<?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-2011 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 will send the notifications after a push in your
* repository.
*/
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]
*
* hgchangegroup.php::run
*
* [sender]
*
* hgchangegroup.php
*
* [description]
*
* This signal allows an application to perform a set of tasks on a
* group change hook of a Mercurial repository. The rel_dir is a
* relative path to the root of your hg repositories but starting with
* a slash.
*
* [parameters]
*
* array('rel_dir' => '/relative/path/to/hg/repository',
* 'env' => array_merge($_ENV, $_SERVER));
*
*/
#$params = array('rel_dir' => $_ENV['PATH_INFO'],
# 'env' => array_merge($_ENV, $_SERVER));
$params = array('rel_dir' => '/home/mercurial/repositories',
'env' => array_merge($_ENV, $_SERVER));
Pluf_Signal::send('hgchangegroup.php::run', 'hgchangegroup.php', $params);

View File

@ -0,0 +1,20 @@
#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories
# Path to repo or hgweb config to serve (see 'hg help hgweb')
# config = "/path/to/repo/or/config"
config = "/home/www/indefero/scripts/hgweb.config"
# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")
# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgwebdir, wsgicgi
application = hgwebdir(config)
wsgicgi.launch(application)

View File

@ -0,0 +1,127 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<link rel="icon" href="/repo/hg-stable/static/hgicon.png" type="image/png" />
<meta name="robots" content="index, nofollow" />
<link rel="stylesheet" href="/repo/hg-stable/static/style-paper.css" type="text/css" />
<script type="text/javascript" src="/repo/hg-stable/static/mercurial.js"></script>
<title>Mercurial (stable branch): 04eb7d7e115b hgweb.cgi</title>
</head>
<body>
<div class="container">
<div class="menu">
<div class="logo">
<a href="http://mercurial.selenic.com/">
<img src="/repo/hg-stable/static/hglogo.png" alt="mercurial" /></a>
</div>
<ul>
<li><a href="/repo/hg-stable/shortlog/04eb7d7e115b">log</a></li>
<li><a href="/repo/hg-stable/graph/04eb7d7e115b">graph</a></li>
<li><a href="/repo/hg-stable/tags">tags</a></li>
<li><a href="/repo/hg-stable/branches">branches</a></li>
</ul>
<ul>
<li><a href="/repo/hg-stable/rev/04eb7d7e115b">changeset</a></li>
<li><a href="/repo/hg-stable/file/04eb7d7e115b/">browse</a></li>
</ul>
<ul>
<li class="active">file</li>
<li><a href="/repo/hg-stable/file/tip/hgweb.cgi">latest</a></li>
<li><a href="/repo/hg-stable/diff/04eb7d7e115b/hgweb.cgi">diff</a></li>
<li><a href="/repo/hg-stable/comparison/04eb7d7e115b/hgweb.cgi">comparison</a></li>
<li><a href="/repo/hg-stable/annotate/04eb7d7e115b/hgweb.cgi">annotate</a></li>
<li><a href="/repo/hg-stable/log/04eb7d7e115b/hgweb.cgi">file log</a></li>
<li><a href="/repo/hg-stable/raw-file/04eb7d7e115b/hgweb.cgi">raw</a></li>
</ul>
<ul>
<li><a href="/repo/hg-stable/help">help</a></li>
</ul>
</div>
<div class="main">
<h2 class="breadcrumb"><a href="/">Mercurial</a> &gt; <a href="/repo">repo</a> &gt; <a href="/repo/hg-stable">hg-stable</a> </h2>
<h3>view hgweb.cgi @ 19161:04eb7d7e115b</h3>
<form class="search" action="/repo/hg-stable/log">
<p><input name="rev" id="search1" type="text" size="30" /></p>
<div id="hint">find changesets by author, revision,
files, or words in the commit message</div>
</form>
<div class="description">Added signature for changeset cceaf7af4c9e</div>
<table id="changesetEntry">
<tr>
<th class="author">author</th>
<td class="author">&#77;&#97;&#116;&#116;&#32;&#77;&#97;&#99;&#107;&#97;&#108;&#108;&#32;&#60;&#109;&#112;&#109;&#64;&#115;&#101;&#108;&#101;&#110;&#105;&#99;&#46;&#99;&#111;&#109;&#62;</td>
</tr>
<tr>
<th class="date">date</th>
<td class="date age">Sat, 01 Jun 2013 17:10:24 -0500</td>
</tr>
<tr>
<th class="author">parents</th>
<td class="author"><a href="/repo/hg-stable/file/227b9f13db13/hgweb.cgi">227b9f13db13</a> </td>
</tr>
<tr>
<th class="author">children</th>
<td class="author"></td>
</tr>
</table>
<div class="overflow">
<div class="sourcefirst"> line source</div>
<div class="parity0 source"><a href="#l1" id="l1"> 1</a> #!/usr/bin/env python
</div>
<div class="parity1 source"><a href="#l2" id="l2"> 2</a> #
</div>
<div class="parity0 source"><a href="#l3" id="l3"> 3</a> # An example hgweb CGI script, edit as necessary
</div>
<div class="parity1 source"><a href="#l4" id="l4"> 4</a> # See also http://mercurial.selenic.com/wiki/PublishingRepositories
</div>
<div class="parity0 source"><a href="#l5" id="l5"> 5</a>
</div>
<div class="parity1 source"><a href="#l6" id="l6"> 6</a> # Path to repo or hgweb config to serve (see 'hg help hgweb')
</div>
<div class="parity0 source"><a href="#l7" id="l7"> 7</a> config = &quot;/path/to/repo/or/config&quot;
</div>
<div class="parity1 source"><a href="#l8" id="l8"> 8</a>
</div>
<div class="parity0 source"><a href="#l9" id="l9"> 9</a> # Uncomment and adjust if Mercurial is not installed system-wide
</div>
<div class="parity1 source"><a href="#l10" id="l10"> 10</a> # (consult &quot;installed modules&quot; path from 'hg debuginstall'):
</div>
<div class="parity0 source"><a href="#l11" id="l11"> 11</a> #import sys; sys.path.insert(0, &quot;/path/to/python/lib&quot;)
</div>
<div class="parity1 source"><a href="#l12" id="l12"> 12</a>
</div>
<div class="parity0 source"><a href="#l13" id="l13"> 13</a> # Uncomment to send python tracebacks to the browser if an error occurs:
</div>
<div class="parity1 source"><a href="#l14" id="l14"> 14</a> #import cgitb; cgitb.enable()
</div>
<div class="parity0 source"><a href="#l15" id="l15"> 15</a>
</div>
<div class="parity1 source"><a href="#l16" id="l16"> 16</a> from mercurial import demandimport; demandimport.enable()
</div>
<div class="parity0 source"><a href="#l17" id="l17"> 17</a> from mercurial.hgweb import hgweb, wsgicgi
</div>
<div class="parity1 source"><a href="#l18" id="l18"> 18</a> application = hgweb(config)
</div>
<div class="parity0 source"><a href="#l19" id="l19"> 19</a> wsgicgi.launch(application)
</div>
<div class="sourcelast"></div>
</div>
</div>
</div>
<script type="text/javascript">process_dates()</script>
</body>
</html>

View File

@ -0,0 +1,2 @@
[collections]
/home/mercurial/repositories = /home/mercurial/repositories

View File

@ -0,0 +1,22 @@
#!/bin/sh
#
# This hook informs IDF that new revisions arrived in the database
# of the specified project.
#
# 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 call it into your monotonerc file
# from the hook "note_netsync_end". (See chapter "Event Notifications
# and Triggers" on <http://monotone.ca/docs/Hooks.html#Hooks>.)
#
dir=$(dirname "$0")
res=$(cd "$dir" && /bin/pwd || "$dir")
SCRIPTDIR="$res/$(readlink $0)"
PHP_POST_PUSH=$SCRIPTDIR/mtnpostpush.php
TMPFILE=$(mktemp /tmp/mtn-post-push.XXXXXX) || exit 1
while read rev; do echo $rev >> $TMPFILE; done
echo php $PHP_POST_PUSH "$1" \< $TMPFILE \&\& rm -f $TMPFILE |\
at now > /dev/null 2>&1

View File

@ -0,0 +1,63 @@
<?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-2011 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 will send the notifications after a push in your
* repository.
*/
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]
*
* mtnpostpush.php::run
*
* [sender]
*
* mtnpostpush.php
*
* [description]
*
* This signal allows an application to perform a set of tasks
* after a push to a monotone repository.
*
* [parameters]
*
* array('project' => 'name-of-the-project',
* 'revisions' => array('123abc...', '456def...', ...));
*
*/
fwrite(STDERR, "waiting for revisions on STDIN...\n");
$stdin = file_get_contents('php://stdin');
$params = array('project' => $argv[1],
'revisions' => explode("\n", chop($stdin)));
Pluf_Signal::send('mtnpostpush.php::run', 'mtnpostpush.php', $params);

View File

View File

@ -0,0 +1,69 @@
<?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-2011 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 process the queue of items.
*
* At the moment the queue is only used for the webhooks, but it would
* be good in the future to use it for indexing and email
* notifications.
*
*/
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'));
#;*/ ::
$lock_file = Pluf::f('idf_queuecron_lock',
Pluf::f('tmp_folder', '/tmp').'/queuecron.lock');
if (file_exists($lock_file)) {
Pluf_Log::event(array('queuecron.php', 'skip'));
return;
}
file_put_contents($lock_file, time(), LOCK_EX);
/**
* [signal]
*
* queuecron.php::run
*
* [sender]
*
* queuecron.php
*
* [description]
*
* This signal allows an application to perform a set of tasks when
* the queue cron job is run. This is done usually every 5 minutes.
*
* [parameters]
*
* array()
*
*/
$params = array();
Pluf_Signal::send('queuecron.php::run', 'queuecron.php', $params);
unlink($lock_file);

View File

@ -0,0 +1,24 @@
#!/bin/sh
#
# This hook does only one thing:
#
# 1. It calls the svnpostcommit.php script with the current repository
# and revision as argument. The svnpostcommit.php script will then
# trigger the 'svnpostcommit.php::run' event with the repository path
# and revision 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-commit" in your
# $REPOSITORY/hooks folder.
#
# www$ chmod +x /home/www/indefero/scripts/svn-post-commit
# www$ cd /home/svn/repositories/project/hooks
# www$ ln -s /home/www/indefero/scripts/svn-post-commit post-commit
#
SCRIPTDIR=$(dirname $(readlink $0))
PHP_POST_COMMIT=$SCRIPTDIR/svnpostcommit.php
echo php $PHP_POST_COMMIT "$1" "$2" | at now > /dev/null 2>&1

View 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 $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"

View File

@ -0,0 +1,62 @@
<?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-2011 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 will send the notifications after a push in your
* repository.
*/
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]
*
* svnpostcommit.php::run
*
* [sender]
*
* svnpostcommit.php
*
* [description]
*
* This signal allows an application to perform a set of tasks on a
* post commit of a subversion repository.
*
* [parameters]
*
* array('repo_dir' => '/path/to/subversion/repository',
* 'revision' => 1234,
* 'env' => array_merge($_ENV, $_SERVER));
*
*/
$params = array('repo_dir' => $argv[1],
'revision' => $argv[2],
'env' => array_merge($_ENV, $_SERVER));
Pluf_Log::event(array('svnpostcommit.php', 'Send run signal.', $params));
Pluf_Signal::send('svnpostcommit.php::run', 'svnpostcommit.php', $params);

View 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-2011 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);