Indefero

Indefero Commit Details


Date:2010-04-14 06:31:30 (14 years 8 months ago)
Author:Loic d'Anterroches
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:bbc29c889fc1ad5a1aa8d195a097f24b29b38164
Parents: e5ee6d8fca669befc229141a8379fcfa62768ebc
Message:Added the post-update hook at the creation of the git repository.

Changes:

File differences

scripts/git-post-update
1212
1313
1414
15
1516
1617
1718
1819
1920
21
2022
2123
22
24
# 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 -f $0))
FULL_GIT_DIR=$(readlink -f $GIT_DIR)
PHP_POST_UPDATE=$SCRIPTDIR/gitpostupdate.php
echo php $PHP_POST_UPDATE $GIT_DIR | at now
echo php $PHP_POST_UPDATE $FULL_GIT_DIR | at now > /dev/null 2>&1
src/IDF/Plugin/SyncGit.php
6666
6767
6868
69
69
7070
7171
7272
{
// Find the corresponding project.
$git_dir = substr($params['git_dir'], 0, -4); // Chop the ".git"
$elts = explode('#/#', $git_dir, -1, PREG_SPLIT_NO_EMPTY);
$elts = preg_split('#/#', $git_dir, -1, PREG_SPLIT_NO_EMPTY);
$pname = array_pop($elts);
try {
$project = IDF_Project::getOr404($pname);
src/IDF/Plugin/SyncGit/Serve.php
203203
204204
205205
206
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
207229
208230
209231
Pluf_Log::error(array('IDF_Plugin_Git_Serve::initRepository', $res, $fullpath));
throw new Exception(sprintf('Init repository error, exit status %d.', $res));
}
Pluf_Log::info(array('IDF_Plugin_Git_Serve::initRepository', 'success', $fullpath));
Pluf_Log::event(array('IDF_Plugin_Git_Serve::initRepository', 'success', $fullpath));
// Add the post-update hook by removing the original one and add the
// Indefero's one.
$p = realpath(dirname(__FILE__).'/../../../../scripts/git-post-update');
$p = Pluf::f('idf_plugin_syncgit_post_update', $p);
if (!@unlink($fullpath.'/hooks/post-update')) {
Pluf_Log::warn(array('IDF_Plugin_Git_Serve::initRepository',
'post-update hook removal error.',
$fullpath.'/hooks/post-update'));
return;
}
exec(sprintf(Pluf::f('idf_exec_cmd_prefix', '').'ln -s %s %s',
escapeshellarg($p),
escapeshellarg($fullpath.'/hooks/post-update')),
$out, $res);
if ($res != 0) {
Pluf_Log::warn(array('IDF_Plugin_Git_Serve::initRepository',
'post-update hook creation error.',
$fullpath.'/hooks/post-update'));
return;
}
Pluf_Log::debug(array('IDF_Plugin_Git_Serve::initRepository',
'Added post-update hook.', $fullpath));
}
src/IDF/Scm.php
393393
394394
395395
396
396
397397
398398
399399
400
400
401401
402402
403403
* Sync the changes in the repository with the timeline.
*
*/
public static function syncTimeline($project)
public static function syncTimeline($project, $force=false)
{
$cache = Pluf_Cache::factory();
$key = 'IDF_Scm:'.$project->shortname.':lastsync';
if (null === ($res=$cache->get($key))) {
if ($force or null === ($res=$cache->get($key))) {
$scm = IDF_Scm::get($project);
if ($scm->isAvailable()) {
foreach ($scm->getChangeLog($scm->getMainBranch(), 25) as $change) {

Archive Download the corresponding diff file

Page rendered in 0.07992s using 13 queries.