gwynne          Wed Nov  5 18:15:59 2008 UTC

  Added files:                 
    /SVNROOT    phpsvn.options.skel 

  Modified files:              
    /SVNROOT    run-conversion.php 
  Log:
  Complete rewrite of conversion script, and addition of cvs2svn options file 
skeleton.
  
http://cvs.php.net/viewvc.cgi/SVNROOT/run-conversion.php?r1=1.4&r2=1.5&diff_format=u
Index: SVNROOT/run-conversion.php
diff -u SVNROOT/run-conversion.php:1.4 SVNROOT/run-conversion.php:1.5
--- SVNROOT/run-conversion.php:1.4      Fri Oct 31 03:22:27 2008
+++ SVNROOT/run-conversion.php  Wed Nov  5 18:15:59 2008
@@ -1,16 +1,59 @@
 <?php
 
-$version = substr('$Revision: 1.4 $', strlen('$Revision: '), -2);
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// Constants
+$version = substr('$Revision: 1.5 $', strlen('$Revision: '), -2);
 
 $passes = array(
-    'svncreate',        // svnadmin create $SVNROOT
-    'cvs2svn',          // cvs2svn --options
-    'svnrm',            // svn rm $SVNROOT/*/.svn
-    'reorg',            // Reorganize repository
+    'processcvs',       // Process CVS modules
+    'svncreate',        // Create various SVN repositories
+    'cvs2svn',          // Run conversion for each repository
+    'cleanup',          // Preform renaming and removes for each repo
 );
 
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// Includes
 require_once 'Console/CommandLine.php';
 
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// Utility functions
+function v($level, $message)
+{
+    if ($GLOBALS['options']['verbose'] >= $level) {
+        print $message;
+    }
+}
+
+function error($message, $status = 1)
+{
+    print $message;
+    exit($status);
+}
+
+function is_running_pass($pass)
+{
+    return $GLOBALS['options']['pass'] === NULL || $GLOBALS['options']['pass'] 
== $pass;
+}
+
+function scandir_is_meta($value)
+{
+    return !($value === '.' || $value === '..');
+}
+
+function scandir_no_meta($directory)
+{
+    if (func_num_args() == 3) {
+        $results = scandir($directory, func_get_arg(1), func_get_arg(2));
+    } else if (func_num_args() == 2) {
+        $results = scandir($directory, func_get_arg(1));
+    } else if (func_num_args() == 1) {
+        $results = scandir($directory);
+    }
+    return array_filter($results, 'scandir_is_meta');
+}
+
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// Commandline options
 $cmdline_parser = new Console_CommandLine(array(
     'description' => 'PHP Group CVS->SVN respository converter',
     'version' => $version,
@@ -30,8 +73,8 @@
 $cmdline_parser->addOption('svnroot', array(
     'short_name' => '-s',
     'long_name' => '--svnroot',
-    'default' => '/home/repository-svn',
-    'description' => 'Specify the SVN repository to create.',
+    'default' => '/home/svn',
+    'description' => 'Specify the directory for SVN repositories.',
     'action' => 'StoreString'));
 $cmdline_parser->addOption('pass', array(
     'short_name' => '-p',
@@ -40,6 +83,18 @@
     'description' => 'Which pass to run. One of: ' . implode(', ', $passes) . 
'. If not specified, all passes will run.',
     'action' => 'StoreString',
     'choices' => $passes));
+$cmdline_parser->addOption('tempdir', array(
+    'short_name' => '-t',
+    'long_name' => '--tempdir',
+    'default' => '/tmp',
+    'description' => 'Where to store temporary files.',
+    'action' => 'StoreString'));
+$cmdline_parser->addOption('skeleton', array(
+    'short_name' => '-k',
+    'long_name' => '--skeleton',
+    'default' => './phpsvn.options.skel',
+    'description' => 'Skeleton file to use for cvs2svn conversions.',
+    'action' => 'StoreString'));
 
 try {
     $result = $cmdline_parser->parse();
@@ -49,139 +104,358 @@
     exit(1);
 }
 
-function v($level, $message)
-{
-    if ($GLOBALS['options']['verbose'] >= $level) {
-        print $message;
-    }
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// Option verification
+if (!is_dir($options['cvsroot']) || !is_readable($options['cvsroot']) || 
!is_executable($options['cvsroot'])) {
+    error("CVS root directory must exist and be a readable and searchable 
directory.\n");
 }
+$options['cvsroot'] = realpath($options['cvsroot']);
 
-function error($message, $status = 1)
-{
-    print $message;
-    exit($status);
+if (!is_dir($options['svnroot']) || !is_readable($options['svnroot']) || 
!is_executable($options['svnroot'])) {
+    error("SVN root directory must exist, be a directory, and be readable and 
searchable.\n");
 }
+if (is_running_pass('svncreate') && !is_writable($options['svnroot'])) {
+    error("SVN root directory must be writable if running the svncreate 
pass.\n");
+}
+$options['svnroot'] = realpath($options['svnroot']);
 
-if (!is_dir($options['cvsroot']) || !is_readable($options['cvsroot']) || 
!is_executable($options['cvsroot'])) {
-    error("CVS root directory must exist, be a directory, and be readable and 
searchable.\n");
+if (!is_dir($options['tempdir']) || !is_writable($options['tempdir'])) {
+    error("Temporary directory must exist and be a writable directory.\n");
+}
+$options['tempdir'] = realpath($options['tempdir']);
+
+if (!file_exists($options['skeleton']) || is_dir($options['skeleton']) || 
!is_readable($options['skeleton'])) {
+    error("cvs2svn options skeleton must exist and be a readable file.\n");
+}
+$options['skeleton'] = realpath($options['skeleton']);
+
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// Classes
+
+// CVS2SVNConverter: A wrapper around a cvs2svn instance and its options file
+class CVS2SVNConverter
+{
+    private     $optionsFileContents = NULL;
+    private     $outputPath = NULL;
+    
+    public function __construct()
+    {
+        $this->optionsFileContents = 
file_get_contents($GLOBALS['options']['skeleton']);
+        $this->optionsFileContents = str_replace('@@@TEMPDIR@@@', 
$GLOBALS['temp_path'], $this->optionsFileContents);
+    }
+    
+    public function setOutputPath($path)
+    {
+        $this->outputPath = $path;
+    }
+    
+    public function addCVSModule($moduleName, $isMetaModule = false)
+    {
+        $cvspath = $GLOBALS['options']['cvsroot'] . DIRECTORY_SEPARATOR . 
$moduleName . DIRECTORY_SEPARATOR;
+        if ($isMetaModule) {
+            $modprefix = $moduleName . '/';
+            foreach(scandir_no_meta($cvspath) as $module) {
+                $this->optionsFileContents .= <<<EOEXTRA
+run_options.add_project(
+    '{$cvspath}{$module}',
+    trunk_path='{$modprefix}{$module}/trunk',
+    branches_path='{$modprefix}{$module}/branches',
+    tags_path='{$modprefix}{$module}/tags',
+    symbol_transforms=[ReplaceSubstringsSymbolTransform('\\','/'), 
NormalizePathsSymbolTransform()],
+    symbol_strategy_rules=[] + global_symbol_strategy_rules,
+    )
+
+EOEXTRA;
+            }
+        } else {
+            $this->optionsFileContents .= <<<EOEXTRA
+run_options.add_project(
+    '{$cvspath}',
+    trunk_path='{$moduleName}/trunk',
+    branches_path='{$moduleName}/branches',
+    tags_path='{$moduleName}/tags',
+    symbol_transforms=[ReplaceSubstringsSymbolTransform('\\\\','/'), 
NormalizePathsSymbolTransform()],
+    symbol_strategy_rules=[] + global_symbol_strategy_rules,
+    )
+
+EOEXTRA;
+        }
+    }
+    
+    public function run()
+    {
+        $this->optionsFileContents = str_replace('@@@OUTPUT_PATH@@@', 
$this->outputPath, $this->optionsFileContents);
+        do {
+            $seed = mt_rand();
+            $filename = $GLOBALS['temp_path'] . DIRECTORY_SEPARATOR . 
'cvs2svn.options.' . $seed;
+        } while (file_exists($filename));
+        file_put_contents($filename, $this->optionsFileContents);
+
+        $command = "exec cvs2svn --options=" . escapeshellarg($filename);
+        v(2, "Running: '{$command}'...");
+        $cvs2svn_process = proc_open($command, array(
+                0 => array('pipe', 'r'),
+                1 => array('file', $GLOBALS['temp_path'] . DIRECTORY_SEPARATOR 
. 'phpsvn.conversion.' . $seed, 'a'),
+                2 => array('pipe', 'w'),
+            ), $pipes, NULL, NULL);
+        fclose($pipes[0]);
+        $procinfo = array();
+        do {
+            usleep(500000);
+            $procinfo = proc_get_status($cvs2svn_process);
+        } while ($procinfo['running'] == TRUE);
+        $errorText = stream_get_contents($pipes[2]);
+        fclose($pipes[2]);
+        proc_close($cvs2svn_process);
+    
+        if ($procinfo['exitcode'] != 0) {
+            error("\nAn error occurred. Exit status was 
{$procinfo['exitcode']}. Output:\n{$errorText}\n", $procinfo['exitcode']);
+        }
+        v(2, " done.\n");
+    }
 }
 
-if (is_null($options['pass']) || $options['pass'] == 'svncreate') {
-    if (file_exists($options['svnroot'])) {
-        error("SVN root directory can not exist if running the svncreate 
pass.\n");
+// Repository: A collection of related modules
+class Repository
+{
+    private     $repositoryName = NULL;
+    private     $cvsModuleList = array();
+    private     $svnRepositoryPath = NULL;
+    private     $renamingRules = array();
+    
+    public function __construct($repoName)
+    {
+        $this->repositoryName = $repoName;
+        $this->svnRepositoryPath = $GLOBALS['options']['svnroot'] . 
DIRECTORY_SEPARATOR . $this->repositoryName;
+    }
+    
+    public function __toString()
+    {
+        $result  = "Repository named '{$this->repositoryName}'.\n";
+        $result .= "\tCVS modules:\n\t\t";
+        $modList = '';
+        foreach ($this->cvsModuleList as $mod => $meta) {
+            $modList .= $mod . " " . ($meta ? "(meta) " : "");
+        }
+        $result .= wordwrap($modList, 80, "\n\t\t") . "\n";
+//      $result .= "\tRenaming rules:\n\t\t";
+//      $result .= wordwrap(str_replace("\n", "\n\t\t", 
print_r($this->renamingRules, 1)), 80, "\n\t\t");
+        return trim($result);
+    }
+    
+    public function addCVSModule($module, $isMeta = FALSE)
+    {
+        $this->cvsModuleList[$module] = $isMeta;
+    }
+    
+    public function addRenameRule($rule)
+    {
+        $this->renamingRules[] = $rule;
+    }
+    
+    public function createSVNRepository()
+    {
+        if (file_exists($this->svnRepositoryPath)) {
+            if (!is_readable($this->svnRepositoryPath) || 
!is_writable($this->svnRepositoryPath)) {
+                error("Directory '{$this->svnRepositoryPath}' is in the 
way.\n");
+            }
+            // Repo already exists
+            return;
+        }
+        $command = "exec svnadmin create " . 
escapeshellarg($this->svnRepositoryPath) . " 2>&1";
+        v(1, "Creating SVN repository for '{$this->repositoryName}' in 
{$this->svnRepositoryPath}...\n");
+        v(2, "Running: '{$command}'...");
+        exec($command, $output, $exitstatus);
+        if ($exitstatus != 0) {
+            error("\nAn error occurred. Exit status was {$exitstatus}. 
Output:\n" . implode("\n", $output) . "\n", $exitstatus);
+        }
+        v(2, " done.\n");
+    }
+    
+    public function importCVSModules()
+    {
+        if (!is_dir($this->svnRepositoryPath) || 
!is_writable($this->svnRepositoryPath)) {
+            error("SVN repository at {$this->svnRepositoryPath} doesn't exist 
or isn't writable.\n");
+        }
+        
+        v(1, "Running cvs2svn for '{$this->repositoryName}'...\n");
+        $converter = new CVS2SVNConverter;
+        $converter->setOutputPath($this->svnRepositoryPath);
+        foreach ($this->cvsModuleList as $cvs_module => $isMeta) {
+            $converter->addCVSModule($cvs_module, $isMeta);
+        }
+        $converter->run();
     }
-    if (!is_dir(dirname($options['svnroot'])) || 
!is_writable(dirname($options['svnroot']))) {
-        error("SVN root directory parent must exist, be a directory, and be 
writable if running the svncreate pass.\n");
+    
+    public function fixupRepository($ignoreErrors = FALSE)
+    {
+        v(1, "Executing fixup commands for repository 
'{$this->repositoryName}'...\n");
+        foreach ($renamingRules as $rule) {
+            switch ($rule['mode']) {
+                case 'move_all':
+                    error("Moving tags and branches is not yet supported! TODO 
IMPLEMENT ME.\n");
+                    break;
+                case 'delete':
+                    $command  = "exec svn rm ";
+                    $command .= "-m '[SVN CONVERSION] Reorganization in 
repository {$this->repositoryName}.' ";
+                    $command .= "file:///" . 
escapeshellarg($this->svnRepositoryPath) . "/" . 
escapeshellarg($rule['srcPath']) . " 2>&1";
+                    break;
+                case 'move':
+                    $command  = "exec svn mv ";
+                    $command .= "-m '[SVN CONVERSION] Reorganization in 
repository {$this->repositoryName}.' ";
+                    $command .= "file:///" . 
escapeshellarg($this->svnRepositoryPath) . "/" . 
escapeshellarg($rule['srcPath']) . " ";
+                    $command .= "file:///" . 
escapeshellarg($this->svnRepositoryPath) . "/" . 
escapeshellarg($rule['dstPath']) . " 2>&1";
+                    break;
+            }
+            v(2, "Running: '{$command}'...");
+            exec($command, $output, $exitstatus);
+            if ($exitstatus != 0 && $ignoreErrors === FALSE) {
+                error("\nAn error occurred. Exit status was {$exitstatus}. 
Output:\n" . implode("\n", $output) . "\n", $exitstatus);
+            } else if ($exitStatus != 0) {
+                v(2, " warning: an error occurred\n");
+            } else {
+                v(2, " done.\n");
+            }
+        }
+        v(1, "Done fixing up.");
     }
-} else if (!is_dir($options['svnroot']) || !is_writable($options['svnroot'])) {
-    error("SVN root directory must exist and be writeable if not running the 
svncreate pass.\n");
 }
-       
+
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// Main
 v(1, "PHP Group CVS->SVN respository conversion.\n");
 v(1, "Started at " . date(DATE_RFC2822) . "\n");
 
+$temp_path = $options['tempdir'] . DIRECTORY_SEPARATOR . "phpsvn_tmp";
+v(2, "Creating temporary files directory at {$temp_path}...\n");
+
+if (!file_exists($temp_path)) {
+    if (mkdir($temp_path, 0700, FALSE) === FALSE) {
+        error("Can't create temporary files directory.\n");
+    }
+}
+
 foreach ($passes as $pass) {
-    if (is_null($options['pass']) || $options['pass'] == $pass) {
+    if (is_running_pass($pass)) {
         call_user_func('pass_' . $pass);
     }
 }
 
-function pass_svncreate()
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// processcvs pass
+function pass_processcvs()
 {
-    global $options;
+    global $repoList, $options;
     
-    v(1, "Running svncreate pass...\n");
+    v(1, "Running processcvs pass...\n");
+
+    $repoList = array();
+    $repoList['doc'] = new Repository('php-doc');
+    $repoList['gtk'] = new Repository('php-gtk');
+    $repoList['src'] = new Repository('php-src');
+    $repoList['web'] = new Repository('php-web');
+    $repoList['phd'] = new Repository('phd');
+    $repoList['pear1'] = new Repository('pear');
+    $repoList['other'] = new Repository('other');
+
+    $cvs_modules = scandir_no_meta($options['cvsroot']);
+    foreach ($cvs_modules as $cvs_module) {
+        if ($cvs_module == 'CVSROOT') {
+            continue;
+        }
+        if (count(scandir($options['cvsroot'] . DIRECTORY_SEPARATOR . 
$cvs_module)) == 2) {    // empty
+            continue;
+        }
+        if (in_array($cvs_module, array("smarty", "smarty-web", 'php4.fubar', 
'php4.unused', 'peardoc.backup', 'php3', 'Zend'))) {
+            continue;
+        } else if (in_array($cvs_module, array('php-gtk', 'php-gtk-doc', 
'old-php-gtk-modules'))) {
+            $repoList['gtk']->addCVSModule($cvs_module);
+        } else if (in_array($cvs_module, array('TSRM', 'ZendAPI', 
'ZendEngine2', 'php-src', 'pecl', 'pecl4win', 'php-objc', 'php-lang',
+                'win-installer', 'bindlib_w32', 'zlib', 'pdo-specs'))) {
+            $repoList['src']->addCVSModule($cvs_module, $cvs_module == 'pecl');
+        } else if ($cvs_module == 'phd') {
+            $repoList['phd']->addCVSModule($cvs_module);
+        } else if (in_array($cvs_module, array('pear', 'pearbot', 'pear-core', 
'peardoc'))) {
+            $repoList['pear1']->addCVSModule($cvs_module, $cvs_module == 
'pear');
+        } else if (strncmp($cvs_module, "phpdoc", 6) == 0) {
+            $repoList['doc']->addCVSModule($cvs_module);
+        } else if (substr($cvs_module, -3) == "web") {
+            $repoList['web']->addCVSModule($cvs_module);
+        } else {
+            $repoList['other']->addCVSModule($cvs_module);
+        }
+    }
     
-    $command = "exec svnadmin create {$options['svnroot']} 2>&1";
-    v(2, "Running: '{$command}'...");
-    exec($command, $output, $exitstatus);
-    if ($exitstatus != 0) {
-        error("\nAn error occurred. Exit status was {$exitstatus}. Output:\n" 
. implode("\n", $output) . "\n", $exitstatus);
+    $repoList['doc']->addRenameRule(array('mode' => 'move', 'srcPath' => 
'phpdoc', 'dstPath' => 'doc-base'));
+    $repoList['doc']->addRenameRule(array('mode' => 'move_all', 'srcPath' => 
'doc-base/en', 'dstPath' => 'en'));
+    $repoList['src']->addRenameRule(array('mode' => 'move', 'srcPath' => 
'pdo-specs/trunk', 'dstPath' => 'php-src/ext/pdo/specs'));
+    $repoList['src']->addRenameRule(array('mode' => 'move_all', 'srcPath' => 
'ZendEngine2', 'dstPath' => 'php-src'));
+    $repoList['src']->addRenameRule(array('mode' => 'move_all', 'srcPath' => 
'TSRM', 'dstPath' => 'php-src'));
+    $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'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/branches/shin/tests/events/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/branches/shin/tests/html/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/branches/shin/docs/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/branches/shin/examples/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/tags/start/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/tags/start/tests/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/tags/start/tests/events/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/tags/start/tests/html/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/tags/start/docs/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Selenium/tags/start/examples/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/branches/shin/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/branches/shin/tests/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/branches/shin/tests/events/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/branches/shin/tests/html/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/branches/shin/docs/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/branches/shin/examples/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/tags/start/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/tags/start/tests/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/tags/start/tests/events/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/tags/start/tests/html/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/tags/start/docs/.svn'));
+    $repoList['pear1']->addRenameRule(array('mode' => 'delete', 'srcPath' => 
'pear/Testing_Selenium/tags/start/examples/.svn'));
+
+    v(2, "Prepared " . count($repoList) . " SVN repositories.\n");
+    foreach ($repoList as $repo) {
+        v(2, $repo . "\n");
+    }
+}
+    
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// svncreate pass
+function pass_svncreate()
+{
+    foreach ($GLOBALS['repoList'] as $repo) {
+        $repo->createSVNRepository();
     }
-    v(2, " done.\n");
-    v(3, "Output:\n" . implode("\n", $output) . "\n");
 }
 
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// cvs2svn pass
 function pass_cvs2svn()
 {
-    global $options;
-    
-    v(1, "Running cvs2svn pass...\n");
-    
-    $command = "exec cvs2svn --options=phpsvn.options";
-    v(2, "Running: '{$command} > ./phpsvn.conversion.out 2>&php'...");
-    $cvs2svn_process = proc_open($command, array(
-            0 => array('pipe', 'r'),
-            1 => array('file', './phpsvn.conversion.out', 'w'),
-            2 => array('pipe', 'w'),
-        ), $pipes, NULL, NULL);
-    fclose($pipes[0]);
-    $procinfo = array();
-    
-    do {
-        usleep(500000);
-        $procinfo = proc_get_status($cvs2svn_process);
-    } while ($procinfo['running'] == TRUE);
-    
-    $errorText = stream_get_contents($pipes[2]);
-    fclose($pipes[2]);
-    
-    proc_close($cvs2svn_process);
-    
-    if ($procinfo['exitcode'] != 0) {
-        error("\nAn error occurred. Exit status was {$procinfo['exitcode']}. 
Output:\n{$errorText}\n", $procinfo['exitcode']);
-    }
-    v(2, " done.\n");
-    v(3, "Output is in ./phpsvn.conversion.out.\n");
-}
-
-function pass_svnrm()
-{
-    global $options;
-    
-    v(1, "Running svnrm pass...\n");
-    
-    $command = "exec svn rm -m \"[SVN CONVERSION] Removing .svn directories 
that break SVN checkout.\" " .
-                
"file:///{$options['svnroot']}/pear/Selenium/branches/shin/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/branches/shin/tests/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/branches/shin/tests/events/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/branches/shin/tests/html/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/branches/shin/docs/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/branches/shin/examples/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/tags/start/tests/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/tags/start/tests/events/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/tags/start/tests/html/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/tags/start/docs/.svn " .
-                
"file:///{$options['svnroot']}/pear/Selenium/tags/start/examples/.svn " .
-                "file:///{$options['svnroot']}/pear/Selenium/tags/start/.svn " 
.
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/branches/shin/.svn " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/branches/shin/tests/.svn " 
.
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/branches/shin/tests/events/.svn
 " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/branches/shin/tests/html/.svn
 " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/branches/shin/docs/.svn " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/branches/shin/examples/.svn
 " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/tags/start/.svn " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/tags/start/tests/.svn " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/tags/start/tests/events/.svn
 " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/tags/start/tests/html/.svn 
" .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/tags/start/docs/.svn " .
-                
"file:///{$options['svnroot']}/pear/Testing_Selenium/tags/start/examples/.svn 
2>&1";
-    v(2, "Running: '{$command}'...");
-    exec($command, $output, $exitstatus);
-    if ($exitstatus != 0) {
-        error("\nAn error occurred. Exit status was {$exitstatus}. Output:\n" 
. implode("\n", $output) . "\n", $exitstatus);
-    }
-    v(2, " done.\n");
-    v(3, "Output:\n" . implode("\n", $output) . "\n");
+    foreach ($GLOBALS['repoList'] as $repo) {
+        $repo->importCVSModules();
+    }
 }
 
-function pass_reorg()
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// cleanup pass
+function pass_cleanup()
 {
-    global $options;
-    
-    error("If this were implemented yet, a series of svn cp, svn rm, and svn 
mv commands would follow. It isn't, so they don't. Sorry.\n");
+    foreach ($GLOBALS['repoList'] as $repo) {
+        $repo->fixupRepository();
+    }
 }
 
+// 
-----------------------------------------------------------------------------------------------------------------------------
+// Cleanup
+
+if ($options['pass'] === NULL || $options['pass'] == end($passes)) {
+    v(2, "Removing temporary files.\n");
+    system("rm -Rf " . escapeshellarg($temp_path));
+}
 v(1, "Finished at " . date(DATE_RFC2822) . "\n");
 
 ?>

http://cvs.php.net/viewvc.cgi/SVNROOT/phpsvn.options.skel?view=markup&rev=1.1
Index: SVNROOT/phpsvn.options.skel
+++ SVNROOT/phpsvn.options.skel
# (Be in -*- python -*- mode.)
import re
import os

from cvs2svn_lib.boolean import *
from cvs2svn_lib import config
from cvs2svn_lib import changeset_database
from cvs2svn_lib.common import CVSTextDecoder
from cvs2svn_lib.log import Log
from cvs2svn_lib.project import Project
from cvs2svn_lib.svn_output_option import *
from cvs2svn_lib.revision_manager import *
from cvs2svn_lib.rcs_revision_manager import *
from cvs2svn_lib.checkout_internal import *
from cvs2svn_lib.symbol_strategy import *
from cvs2svn_lib.symbol_transform import *
from cvs2svn_lib.property_setters import *

Log().log_level = Log.VERBOSE
ctx.output_option = ExistingRepositoryOutputOption(
    r'@@@OUTPUT_PATH@@@',
    )
ctx.dry_run = False
ctx.revision_recorder = InternalRevisionRecorder(compress=True)
ctx.revision_excluder = InternalRevisionExcluder()
ctx.revision_reader = InternalRevisionReader(compress=True)
ctx.svnadmin_executable = r'svnadmin'
ctx.sort_executable = r'sort'
ctx.trunk_only = False
ctx.prune = True
ctx.cvs_author_decoder = CVSTextDecoder(
    [
        'latin1',
        'utf8',
        'ascii',
        ],
    )
ctx.cvs_log_decoder = CVSTextDecoder(
    [
        'latin1',
        'utf8',
        'ascii',
        ],
    )
ctx.cvs_filename_decoder = CVSTextDecoder(
    [
        'latin1',
        'utf8',
        'ascii',
        ],
    )
ctx.decode_apple_single = False
ctx.symbol_info_filename = None
global_symbol_strategy_rules = [
    ExcludeRegexpStrategyRule(r'php4/CREDITS'),
    UnambiguousUsageRule(),
    BranchIfCommitsRule(),
    HeuristicStrategyRule(),
    DefaultBasePathRule(),
    HeuristicPreferredParentRule(),
    ]
ctx.username = 'cvs2svn'
ctx.svn_property_setters.extend([
    CVSBinaryFileEOLStyleSetter(),
    CVSBinaryFileDefaultMimeTypeSetter(),
    EOLStyleFromMimeTypeSetter(),
    DefaultEOLStyleSetter('native'),
    SVNBinaryFileKeywordsPropertySetter(),
    KeywordsPropertySetter(config.SVN_KEYWORDS_VALUE),
    ExecutablePropertySetter(),
    CVSRevisionNumberSetter(),
    ])
ctx.tmpdir = r'@@@TEMPDIR@@@'
ctx.cross_project_commits = False
ctx.cross_branch_commits = False
ctx.retain_conflicting_attic_files = True
run_options.profiling = False
changeset_database.use_mmap_for_cvs_item_to_changeset_table = False


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to