cvs: SVNROOT / run-conversion.php

[email protected] ("Gwynne Raskind")
Newsgroups svn.migration
Message-ID <cvsgwynne1226952363@cvsserver>
gwynne		Mon Nov 17 20:06:03 2008 UTC

  Modified files:              
    /SVNROOT	run-conversion.php 
  Log:
  always run processcvs pass, add regex rename operation, use it for phpdoc, fix the fixup rules for pdo-specs
  
http://cvs.php.net/viewvc.cgi/SVNROOT/run-conversion.php?r1=1.44&r2=1.45&diff_format=u
Index: SVNROOT/run-conversion.php
diff -u SVNROOT/run-conversion.php:1.44 SVNROOT/run-conversion.php:1.45
--- SVNROOT/run-conversion.php:1.44	Mon Nov 17 06:43:24 2008
+++ SVNROOT/run-conversion.php	Mon Nov 17 20:06:03 2008
@@ -7,7 +7,7 @@
 
 // -----------------------------------------------------------------------------------------------------------------------------
 // Constants
-$version = substr('$Revision: 1.44 $', strlen('$Revision: '), -2);
+$version = substr('$Revision: 1.45 $', strlen('$Revision: '), -2);
 
 $passes = array(
     'processcvs',       // Process CVS modules
@@ -41,7 +41,8 @@
 
 function is_running_pass($pass)
 {
-    return $GLOBALS['options']['pass'] === NULL || $GLOBALS['options']['pass'] == $pass;
+    // We always run processcvs so the other passes have info to work with
+    return $GLOBALS['options']['pass'] === NULL || $GLOBALS['options']['pass'] == $pass || $GLOBALS['options']['pass'] == 'processcvs';
 }
 
 function scandir_is_meta($value)
@@ -360,6 +361,19 @@
                                  ' file:///' . escapeshellarg($this->svnRepositoryPath) . '/' . escapeshellarg($dstPath));
     }
     
+    private function renameMatchingPaths($base, $match, $replacement, $message)
+    {
+        $basePath = 'file:///' . escapeshellarg($this->svnRepositoryPath) . '/' escapeshellarg($base);
+        $completeList = $this->executeSVNCommand('ls ' . $basePath);
+        foreach ($completeList as $value) {
+            if (preg_match($match, $value) === 1) {
+                $dstPath = preg_replace($match, $replacement, $value);
+                $this->executeSVNCommand('mv -m ' . escapeshellarg($message) .
+                                         ' ' . $basePath . '/' . escapeshellarg($value) . ' ' . $basePath . '/' . escapeshellarg($dstPath));
+            }
+        }
+    }
+    
     public function fixupRepository()
     {
         v(1, "Executing fixup commands for repository '{$this->repositoryName}'...\n");
@@ -375,6 +389,9 @@
                 case 'move':
                     $this->movePath($rule['srcPath'], $rule['dstPath'], $message);
                     break;
+                case 'rename':
+                    $this->renameMatchingPaths($rule['basePath'], $rule['match'], $rule['replacement'], $message);
+                    break;
             }
         }
         v(1, "Done fixing up.\n");
@@ -504,8 +521,10 @@
     $repoList['doc']->addRenameRule(array('mode' => 'mkdir', 'srcPath' => 'en/branches'));
     $repoList['doc']->addRenameRule(array('mode' => 'move', 'srcPath' => 'phpdoc/trunk/en', 'dstPath' => 'en/trunk'));
     $repoList['doc']->addRenameRule(array('mode' => 'move', 'srcPath' => 'phpdoc', 'dstPath' => 'doc-base'));
+    $repoList['doc']->addRenameRule(array('mode' => 'rename', 'basePath' => '', 'match' => '^phpdoc-(.*)$', 'replacement' => "\\1"));
     // Fixup rules for php-src
-    $repoList['src']->addRenameRule(array('mode' => 'move', 'srcPath' => 'pdo-specs/trunk', 'dstPath' => 'php-src/trunk/ext/pdo/specs'));
+    $repoList['src']->addRenameRule(array('mode' => 'move', 'srcPath' => 'pdo-specs/trunk', 'dstPath' => 'pecl/pdo/trunk/specs'));
+    $repoList['src']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pdo-specs'));
     // Fixup rules for pear1
     $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/branches/shin/.svn'));
     $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 'pear/Selenium/branches/shin/tests/.svn'));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.