cvs: SVNROOT / pre-commit

From: Date: Wed, 24 Jun 2009 13:55:18 +0000
Subject: cvs: SVNROOT / pre-commit
Groups: svn.migration 
Request: Send a blank email to svn-migration+get-359@lists.php.net to get a copy of this message
gwynne Wed Jun 24 13:55:18 2009 UTC Modified files: /SVNROOT pre-commit Log: more useful output when svnlook fails, correct processing of newly added paths http://cvs.php.net/viewvc.cgi/SVNROOT/pre-commit?r1=1.8&r2=1.9&diff_format=u Index: SVNROOT/pre-commit diff -u SVNROOT/pre-commit:1.8 SVNROOT/pre-commit:1.9 --- SVNROOT/pre-commit:1.8 Mon Jun 22 12:38:57 2009 +++ SVNROOT/pre-commit Wed Jun 24 13:55:18 2009 @@ -15,7 +15,7 @@ // ----------------------------------------------------------------------------------------------------------------------------- // Constants -$version = substr('$Revision: 1.8 $', strlen('$Revision: '), -2); +$version = substr('$Revision: 1.9 $', strlen('$Revision: '), -2); $is_DEBUG = (isset($_ENV['DEBUG']) && $_ENV['DEBUG'] === 'DEBUG'); // ----------------------------------------------------------------------------------------------------------------------------- @@ -37,10 +37,11 @@ function run_svnlook($command, $extra_args = array()) { $selector = $GLOBALS['is_DEBUG'] ? '-r' : '-t'; - exec('exec svnlook ' . escapeshellarg($command) . " {$selector} " . escapeshellarg($GLOBALS['TXN']) . ' ' . - escapeshellarg($GLOBALS['REPOS']) . ' ' . implode(' ', array_map('escapeshellarg', $extra_args)) . ' 2>&1', $output, $status); + $cmd = 'exec svnlook ' . escapeshellarg($command) . " {$selector} " . escapeshellarg($GLOBALS['TXN']) . ' ' . + escapeshellarg($GLOBALS['REPOS']) . ' ' . implode(' ', array_map('escapeshellarg', $extra_args)) . ' 2>&1'; + exec($cmd, $output, $status); if ($status != 0) { - fail("svnlook failed with exit code {$status}\nOutput:\n" . implode("\n", $output) . "\n"); + fail("svnlook ({$cmd}) failed with exit code {$status}\nOutput:\n" . implode("\n", $output) . "\nBacktrace:\n" . print_r(debug_backtrace(), 1)); } return $output; } @@ -166,10 +167,14 @@ // Changing text files requires svn:keywords set $paths_added = array_filter($paths_changed, create_function('$v', 'return ($v[0] === "A");')); foreach ($paths_added as $path_added) { - $path_added = substr($path_added, strpos($path_added, ' ') + 1); + preg_match('/^([^[:space:]]+)[[:space:]]+(.*)$/uX', $path_added, $matches); + $path_added = $matches[2]; if ($is_DEBUG) { print "DEBUG: Checking properties for {$path_added}.\n"; } + if (substr($path_added, -1) === '/') { // is a directory? + continue; + } $properties = array_map('trim', run_svnlook('proplist', array($path_added))); if (in_array('svn:mime-type', $properties)) {

« previous svn.migration (#359) next »