Commit: 9ae86325126874f4645c8bf4ed4ac156b97d9bdc
Author: Florian Anderiasch(f...@php.net)         Thu, 8 Mar 2012 09:27:53 +0100
Committer: Florian Anderiasch(f...@php.net)      Thu, 8 Mar 2012 09:27:53 +0100
Parents: 7d3adc9b7f30027dadbccf1038979cbcd7bff94d

Link: 
http://git.php.net/?p=karma.git;a=commitdiff;h=9ae86325126874f4645c8bf4ed4ac156b97d9bdc

Log:
Add slightly adapted commit-bugs.php and hook script

Changed paths:
  M  hooks/commit-bugs.php
  A  hooks/post-receive.bugsweb


Diff:
9ae86325126874f4645c8bf4ed4ac156b97d9bdc
diff --git a/hooks/commit-bugs.php b/hooks/commit-bugs.php
index f62cb8b..df5b913 100644
--- a/hooks/commit-bugs.php
+++ b/hooks/commit-bugs.php
@@ -13,7 +13,7 @@ $bug_url_prefixes = array(
     '' => 'https://bugs.php.net',
 );
 $bug_rpc_url = 'https://bugs.php.net/rpc.php';
-$viewvc_url_prefix = 'http://svn.php.net/viewvc/?view=revision&revision=';
+//$viewvc_url_prefix = 'http://svn.php.net/viewvc/?view=revision&revision=';
 
 // 
-----------------------------------------------------------------------------------------------------------------------------
 // Get the list of mentioned bugs from the commit log
diff --git a/hooks/post-receive.bugsweb b/hooks/post-receive.bugsweb
new file mode 100755
index 0000000..9dc403f
--- /dev/null
+++ b/hooks/post-receive.bugsweb
@@ -0,0 +1,62 @@
+#!/usr/bin/env php
+<?php
+namespace Karma;
+
+const KARMA_FILE = '/git/checkout/SVNROOT/global_avail';
+const REPOSITORY_PATH = '/git/repositories';
+const LIB_PATH = '/git/checkout/karma/lib';
+
+set_include_path(
+    getenv('KARMA_LIB_PATH') ?: LIB_PATH .
+    PATH_SEPARATOR .
+    get_include_path());
+
+include 'Git.php';
+include 'Git/PushInformation.php';
+include 'Git/ReceiveHook.php';
+
+$hook = new \Git\ReceiveHook(KARMA_FILE, REPOSITORY_PATH);
+$rpath = $hook->getReceivedMessages();
+
+$template = "Automatic comment from GIT on behalf of %s
+Revision: http://git.php.net/%s
+Log: %s";
+
+foreach ($rpath as $commit) {
+    // should look like this: "[u...@php.net] 0df3233344 Fixed bug #1234 It 
works!"
+    $pattern = '(\[([^\]]+)\] ([0-9a-f]+)(.*Fix(ed)? (bug )?\#([0-9]+)(.*)))i';
+    preg_match($pattern, $commit, $matches);
+
+    if (!isset($matches[1])) {
+        continue;
+    }
+
+    $committer  = $matches[1];
+    $commitHash = $matches[2];
+    $commitMsg  = trim($matches[3]);
+    $bugNumber  = $matches[6];
+    $shortMsg   = trim($matches[7]);
+    if ($shortMsg[0] == '(') {
+        $shortMsg = substr($shortMsg, 1);
+    }
+    if ($shortMsg[strlen($shortMsg)-1] == ')') {
+        $shortMsg = substr($shortMsg, 0, -1);
+    }
+
+    $output = sprintf(
+        $template,
+        $committer,
+        $commitHash,
+        $commitMsg
+    );
+
+    $commit_info = array();
+    $commit_info['log_message'] = $commitMsg;
+    $commit_info['author'] = $committer;
+    $viewvc_url_prefix = sprintf(
+        'http://git.php.net/?p=%s.git;a=commit;h=',
+        $hook->getRepositoryName()
+    );
+    $REV = $commitHash;
+    require __DIR__ . '/commit-bugs.php';
+}



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to