Skip to content

Commit 530060a

Browse files
committed
- make cvs/svn code look alike for easier comparing them
1 parent eb6fa37 commit 530060a

File tree

2 files changed

+19
-32
lines changed

2 files changed

+19
-32
lines changed

scm/eventum-cvs-hook

+6-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// | Boston, MA 02111-1307, USA. |
2626
// +----------------------------------------------------------------------+
2727
// | Authors: João Prado Maia <[email protected]> |
28+
// | Elan Ruusamäe <[email protected]> |
2829
// +----------------------------------------------------------------------+
2930

3031
// URL to your Eventum installation.
@@ -51,6 +52,10 @@ if (in_array($msg, array('- Imported sources', '- New directory'))) {
5152
exit(0);
5253
}
5354

55+
// get the full commit message
56+
$input = getInput();
57+
$commit_msg = rtrim(substr($input, strpos($input, 'Log Message:') + strlen('Log Message:') + 1));
58+
5459
// now parse the list of modified files
5560
$modified_files = array();
5661
foreach ($args as $file_info) {
@@ -62,11 +67,7 @@ foreach ($args as $file_info) {
6267
);
6368
}
6469

65-
// get the full commit message
66-
$input = getInput();
67-
$commit_msg = rtrim(substr($input, strpos($input, 'Log Message:') + strlen('Log Message:') + 1));
68-
69-
// parse the commit message and get the first issue number we can find
70+
// parse the commit message and get all issue numbers we can find
7071
preg_match_all('/(?:issue|bug) ?:? ?#?(\d+)/i', $commit_msg, $matches);
7172

7273
if (count($matches[1]) > 0) {

scm/eventum-svn-hook

+13-27
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,10 @@ $eventum_url = 'http://eventum.example.com/';
4141
//
4242
// DO NOT CHANGE ANYTHING AFTER THIS LINE
4343
//
44-
// save name of this script
45-
$PROGRAM = basename(array_shift($argv));
4644

47-
if (isset($eventum_url)) {
48-
$data = parse_url($eventum_url);
49-
} else {
50-
// legacy
51-
$data = array();
52-
$data['host'] = $eventum_domain;
53-
$data['path'] = $eventum_relative_url;
54-
$data['port'] = $eventum_port;
55-
$data['scheme'] = 'http';
56-
}
5745

58-
if (!isset($data['port'])) {
59-
$data['port'] = $data['scheme'] == 'https' ? 443 : 80;
60-
}
46+
// save name of this script
47+
$PROGRAM = basename(array_shift($argv));
6148

6249
if (!isset($svnlook)) {
6350
$svnlook = '/usr/bin/svnlook';
@@ -74,31 +61,30 @@ if ($argc < 3) {
7461
}
7562

7663
$repos = $argv[1];
77-
$rev = $argv[2];
78-
$oldRev = $rev - 1;
64+
$new_revision = $argv[2];
65+
$old_revision = $new_revision - 1;
7966

8067
$scm_module = rawurlencode(basename($repos));
8168

82-
$results = array();
83-
exec($svnlook . ' info ' . $repos . ' -r ' . $rev, $results);
84-
69+
exec($svnlook . ' info ' . $repos . ' -r ' . $new_revision, $results);
8570
$username = array_shift($results);
8671
$date = array_shift($results);
87-
array_shift($results); // ignore file length
72+
// ignore file length
73+
array_shift($results);
8874

75+
// get the full commit message
8976
$commit_msg = join("\n", $results);
90-
// now we have to strip html-tags from the commit message
91-
$commit_msg = strip_tags($commit_msg);
9277

93-
$files = array();
94-
exec($svnlook . ' changed ' . $repos . ' -r ' . $rev, $files);
78+
// now parse the list of modified files
79+
$modified_files = array();
80+
exec($svnlook . ' changed ' . $repos . ' -r ' . $new_revision, $files);
9581
foreach ($files as $file_info) {
9682
$pieces = explode(' ', $file_info);
9783
$filename = $pieces[1];
9884
$modified_files[] = array(
9985
'filename' => $filename,
100-
'old_revision' => $oldRev,
101-
'new_revision' => $rev
86+
'old_revision' => $old_revision,
87+
'new_revision' => $new_revision
10288
);
10389
}
10490

0 commit comments

Comments
 (0)