gwynne Mon, 20 Jul 2009 15:05:54 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=284443
Changed paths:
U SVNROOT/pre-commit
Log:
enable per-file avail checks
Modified: SVNROOT/pre-commit
===================================================================
--- SVNROOT/pre-commit 2009-07-20 15:00:54 UTC (rev 284442)
+++ SVNROOT/pre-commit 2009-07-20 15:05:54 UTC (rev 284443)
@@ -48,8 +48,8 @@
function pattern_matches_commit($pattern)
{
- foreach ($GLOBALS['dirs_changed'] as $dir_changed) {
- if (!preg_match($pattern, $dir_changed)) {
+ foreach ($GLOBALS['paths_changed'] as $path_changed) {
+ if (!preg_match($pattern, $path_changed)) {
return FALSE;
}
}
@@ -71,17 +71,15 @@
//
-----------------------------------------------------------------------------------------------------------------------------
// Build list of changes
if ($is_DEBUG) {
- $data = explode("\n::\n", trim(stream_get_contents(STDIN)));
- $paths_changed = explode("\n", $data[0]);
- $dirs_changed = explode("\n", $data[1]);
+ $paths_changed = explode("\n", trim(stream_get_contents(STDIN)));
$log_message = array('test1', 'test2');
$author = $argv[3];
} else {
$paths_changed = run_svnlook('changed');
- $dirs_changed = run_svnlook('dirs-changed');
$log_message = run_svnlook('log');
$author = trim(implode("\n", run_svnlook('author')));
}
+array_walk($paths_changed, create_function('&$v, $k', '$v = trim($v); $v =
ltrim(substr($v, strcspn($v, " \t")));'));
//
-----------------------------------------------------------------------------------------------------------------------------
// Log message empty?
@@ -112,7 +110,7 @@
//
-----------------------------------------------------------------------------------------------------------------------------
// Check commit against it
$exit_val = 0;
-foreach ($dirs_changed as $dir_changed) {
+foreach ($paths_changed as $path_changed) {
foreach ($avail_lines as $avail_line) {
if (strncmp($avail_line, 'unavail', 7) == 0) {
$bit = 0;
@@ -138,7 +136,7 @@
$in_repo = count($modulelist) == 0;
if (!$in_repo) {
foreach ($modulelist as $module) {
- if (fnmatch("{$module}*", $dir_changed)) {
+ if (fnmatch("{$module}*", $path_changed)) {
$in_repo = TRUE;
}
}
@@ -153,7 +151,7 @@
print "DEBUG: User {$author} " . ($user_in_list ? "matched" :
"did not match") . " user list: " . implode(",", $userlist) . "\n";
}
if ($in_repo) {
- print "DEBUG: Directory {$dir_changed} " . ($in_repo ?
"matched" : "did not match") . " repo list: " . implode(",", $modulelist) .
"\n";
+ print "DEBUG: Path {$path_changed} " . ($in_repo ? "matched" :
"did not match") . " repo list: " . implode(",", $modulelist) . "\n";
}
if ($user_in_list || $in_repo) {
print "DEBUG: exit_val == {$exit_val} for " .
var_export($user_in_list, 1) . "/" . var_export($in_repo, 1) . ".\n";
@@ -161,22 +159,22 @@
}
}
if ($exit_val) { // if one dir fails, all fail
- $last_dir = $dir_changed;
+ $last_path = $path_changed;
break;
}
}
if ($exit_val) {
- if (preg_match('/^pear/', $last_dir)) {
+ if (preg_match('/^pear/', $last_path)) {
$access_contact_email = '[email protected]';
- } else if (preg_match('/^pecl/', $last_dir)) {
+ } else if (preg_match('/^pecl/', $last_path)) {
$access_contact_email = '[email protected]';
- } else if (preg_match('/^phpdoc/', $last_dir)) {
+ } else if (preg_match('/^phpdoc/', $last_path)) {
$access_contact_email = '[email protected]';
} else {
$access_contact_email = '[email protected]';
}
- fail("*******\nAccess denied: Insufficient karma for {$author} to
{$last_dir}.\nContact {$access_contact_email} for access.\n");
+ fail("*******\nAccess denied: Insufficient karma for {$author} to
{$last_path}.\nContact {$access_contact_email} for access.\n");
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php