Solution: Checking out all projects.ez.no subversion repositories

Problem

There is a lot of individual projects svn repositories!
How to get your head around so many projects.
This is how you can check them all out quickly ...

Resources

  • Project Repositories: List of svn repository url locations within in csv file, repositories.csv
    • Warning: "...there are DOS EOL markers XD in that .csv file XD"

Solutions

Checking out with shell commands

wget -q -O - 'http://projects.ez.no/repositories.csv' | tr -d '\015' | xargs -i svn co {}

Checking out with php commands

<?php
 
 
$handle = fopen( "http://projects.ez.no/repositories.csv", "r" );
$row = 1;
 
while ( ( $data = fgetcsv( $handle, 1000, "," ) ) !== FALSE) {
    $num = count($data);
    // echo "** <p> $num fields in line $row: <br /></p>\n";
 
    $row++;
    for ($c=0; $c < $num; $c++) {
        $line = $data[$c];
 
        $repo = escapeshellcmd( $line );
        $name = split( "/", $repo );
        $name = $name[3];
        // print_r( $name );
        // Example: http://svn.projects.ez.no/bcwebsitestatistics
 
        $last_line = system("svn co $repo", $retval );
 
        echo "Repository Name: ". $name . "\n";
        echo "Repository URL: ". $repo . "\n";
        echo "Checkout Last Line: ". $last_line . "\n";
 
        if( $retval == "0" )
        {
          echo "Checkout: ". "Success" . "\n";
        }
        else {
          echo "Checkout: ". "Failure" . "\n";
        }
        echo "\n\n";
 
        // DEBUG: Print additional information
        /*
        echo '
        </pre>
        <hr />Last line of the output: ' . $last_line . '
        <hr />Return value: ' . $retval . "\n\n";
        */
    }
}
 
fclose( $handle );
 
?>