Created
February 5, 2011 18:30
-
-
Save neclimdul/812664 to your computer and use it in GitHub Desktop.
Import all d.o projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ ! $C2G_CONCURRENCY ]; then | |
C2G_CONCURRENCY=8 # set to the number of cores you want to pwn with the migration process | |
fi | |
if [ ! $C2G_REPOSITORY ]; then | |
C2G_REPOSITORY=/var/git/cvsmirror # replace with path to the root of the local repository | |
fi | |
if [ ! $C2G_DESTINATION ]; then | |
C2G_DESTINATION=/var/git/repositories | |
fi | |
if [ ! $C2G_PHP ]; then | |
C2G_PHP="/usr/bin/php" | |
fi | |
mkdir -p $C2G_DESTINATION/project | |
# do special-case handling for docs, tricks, and finally core. Do these first in the background because they take a while. | |
$C2G_PHP import-project.php ./cvs2git.options $C2G_REPOSITORY contributions/docs $C2G_DESTINATION/project/docs.git & | |
$C2G_PHP import-project.php ./cvs2git.options $C2G_REPOSITORY contributions/tricks $C2G_DESTINATION/project/tricks.git & | |
$C2G_PHP import-project.php ./cvs2git.options $C2G_REPOSITORY drupal $C2G_DESTINATION/project/drupal.git & | |
# migrate all the parent dirs for which each child receives a repo in the shared, top-level namespace (project) | |
for TYPE in modules themes theme-engines profiles; do | |
PREFIX="contributions/$TYPE" | |
find $C2G_REPOSITORY/$PREFIX/ -mindepth 1 -maxdepth 1 -type d -not -empty | xargs -I% basename % | egrep -v "Attic" | xargs --max-proc $C2G_CONCURRENCY -I% sh -c "$C2G_PHP import-project.php ./cvs2git.options $C2G_REPOSITORY $PREFIX/% $C2G_DESTINATION/project/%.git" | |
done | |
if [ "$FINAL_CLEANUP " != " " ]; then | |
find $C2G_DESTINATION/project -mindepth 1 -maxdepth 1 -type d -not -empty | xargs --max-proc $C2G_CONCURRENCY -I% sh -c "$C2G_PHP import-cleanup.php -k -t -d %" | |
fi | |
# migrate all translation project dirs in a separate pass | |
find $C2G_REPOSITORY/contributions/translations -mindepth 1 -maxdepth 1 -type d -not -empty | xargs -I% basename % | egrep -v "Attic" | xargs --max-proc $C2G_CONCURRENCY -I% sh -c "$C2G_PHP import-project.php ./cvs2git.options $C2G_REPOSITORY $PREFIX/% $C2G_DESTINATION/translations-tmpout/%.git" | |
if [ "$FINAL_CLEANUP " != " " ]; then | |
find $C2G_DESTINATION/translations-tmpout -mindepth 1 -maxdepth 1 -type d -not -empty | xargs --max-proc $C2G_CONCURRENCY -I% sh -c "$C2G_PHP import-cleanup.php -k -d %" | |
fi | |
# move translations tmpout into main output location | |
find $C2G_DESTINATION/translations-tmpout -mindepth 1 -maxdepth 1 -type d -not -empty -name '*.git' -exec mv '{}' $C2G_DESTINATION/project/ \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment