cvs: SVNROOT / global_avail pear_avail pre-commit
[email protected] ("Gwynne Raskind")
| Newsgroups | svn.migration |
|---|---|
| Message-ID | <cvsgwynne1229406223@cvsserver> |
gwynne Tue Dec 16 05:43:43 2008 UTC
Added files:
/SVNROOT global_avail pear_avail
Modified files:
/SVNROOT pre-commit
Log:
tons of bug fixes and debug crap for pre-commit, global and pear avail files
http://cvs.php.net/viewvc.cgi/SVNROOT/pre-commit?r1=1.1&r2=1.2&diff_format=u
Index: SVNROOT/pre-commit
diff -u SVNROOT/pre-commit:1.1 SVNROOT/pre-commit:1.2
--- SVNROOT/pre-commit:1.1 Mon Dec 15 20:43:31 2008
+++ SVNROOT/pre-commit Tue Dec 16 05:43:43 2008
@@ -8,7 +8,7 @@
// -----------------------------------------------------------------------------------------------------------------------------
// Constants
-$version = substr('$Revision: 1.1 $', strlen('$Revision: '), -2);
+$version = substr('$Revision: 1.2 $', strlen('$Revision: '), -2);
// -----------------------------------------------------------------------------------------------------------------------------
// Version check
@@ -59,20 +59,25 @@
// -----------------------------------------------------------------------------------------------------------------------------
// Build list of changes
-$changed_paths = run_svnlook('changed');
-$dirs_changed = run_svnlook('dirs-changed');
-$log_message = run_svnlook('log');
-$author = run_svnlook('author');
+if (isset($_ENV['DEBUG']) && $_ENV['DEBUG'] == 'DEBUG') {
+ $dirs_changed = explode("\n", trim(stream_get_contents(STDIN)));
+ $log_message = array('test1', 'test2');
+ $author = $argv[2];
+} else {
+ $dirs_changed = run_svnlook('dirs-changed');
+ $log_message = run_svnlook('log');
+ $author = run_svnlook('author');
+}
// -----------------------------------------------------------------------------------------------------------------------------
// Log message empty?
if (strlen(trim(implode("\n", $log_message))) == 0) {
- die("Please specify a log message.");
+ die("Please specify a log message.\n");
}
// -----------------------------------------------------------------------------------------------------------------------------
// Read avail database
-if (pattern_matches_commit('pear/*')) {
+if (pattern_matches_commit('*pear*')) {
$avail_db = __DIR__ . '/pear_avail';
} else {
$avail_db = __DIR__ . '/global_avail';
@@ -92,8 +97,8 @@
} else {
continue;
}
-
- $params = explode_noempty("|", $avail_line);
+
+ $params = explode("|", trim($avail_line));
if (count($params) == 1) { // avail/unavail by itself
if (!$bit) {
$universal_off = TRUE;
@@ -108,18 +113,30 @@
$modulelist = explode_noempty(",", $params[2]);
}
$user_in_list = in_array($author, $userlist) || count($userlist) == 0;
-
+
$in_repo = count($modulelist) == 0;
if (!$in_repo) {
foreach ($modulelist as $module) {
- if (fnmatch("{$module}/*", $dir_changed)) {
+ if (fnmatch("{$module}*", $dir_changed)) {
$in_repo = TRUE;
}
}
}
-
+
if ($user_in_list && $in_repo) {
- $exit_val = $bit;
+ $exit_val = $bit ? 0 : 1;
+ }
+
+ if (isset($_ENV['DEBUG']) && $_ENV['DEBUG'] == 'DEBUG') {
+ if ($user_in_list) {
+ 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";
+ }
+ 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";
+ }
}
}
if ($exit_val) { // if one dir fails, all fail
@@ -129,7 +146,11 @@
}
if ($exit_val) {
- die("Access denied: Insufficient karma for {$author} to {$last_dir}.");
+ die("Access denied: Insufficient karma for {$author} to {$last_dir}.\n");
+}
+
+if (isset($_ENV['DEBUG']) && $_ENV['DEBUG'] == 'DEBUG') {
+ print "DEBUG: Access granted.\n";
}
exit(0);