Switch the 'modify' code of admin/field.php to use templates
[bugdar.git] / docs / post-commit.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2004-2009 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * USAGE:
24 *
25 * Change the two constants below to reflect your setup. Then, in your repository's
26 * /hooks/post-commit script, add the following line:
27 *
28 * /path/to/this/script/post-commit.php "$REPOS" "$REV"
29 */
30
31 // this is the path to the SVN binaries (namely, svnlook)
32 define('SVN_PATH', '/usr/local/bin/');
33
34 // path to Bugdar base install
35 define('BUGDAR_BASE', '/Server/htdocs/bugtrack/');
36
37 // ###################################################################
38
39 if ($argc != 3)
40 {
41 print("Usage: $argv[0] repository revision");
42 exit;
43 }
44
45 exec(SVN_PATH . 'svnlook log -r' . $argv[2] . ' "' . $argv[1] . '"', $output);
46 $output = implode("\n", $output);
47
48 if (preg_match_all('#(fixe(s|d)|close(s|d)) bug://(report/)?([0-9]*)#i', $output, $matches) != false)
49 {
50 chdir(BUGDAR_BASE);
51 include 'includes/init.php';
52 include 'includes/api_bug.php';
53
54 foreach ($matches[5] AS $id)
55 {
56 $api = new BugAPI();
57 $api->set('bugid', $id);
58 $api->set_condition();
59 $api->set('status', 4);
60 $api->set('resolution', 2);
61 $api->update();
62 }
63 }
64
65 ?>