Importing Moodle CVS history into git
To begin we must import the CVS repository into a local git filesystem using git-cvsimport.
#!/bin/bash CVSROOT=:pserver:firstname.lastname@example.org:/cvsroot/moodle MODULE=moodle INSTALLDIR=moodle git cvsimport -p x -v -k -o cvshead -d $CVSROOT -C $INSTALLDIR $MODULE &> cvsimport.log
(When might one want to use the -m -u and -s flags?)
-u purely cosmetic -s slashes can cause problems but this doesn't seem to be the case with moodle -m ?
This will run for a very long time as it checks out every revision of each file (including all branches). However, if you run the command after a successful initial run it will simply get the new revisions since it was last run. This creates a new git repository which can then be cloned and worked upon.
At the time of writing the size of a new Moodle git repository was approximately 866MB unpacked, and 75MB packed. Newer versions of git pack the project during import, so your resulting repository plus checkout should be a bit over 100MB. Still, it is a good idea to pack the repository to make it smaller and faster, running
git-repack -a -d
With the -o cvshead flag, the "HEAD" of the CVS repo will appear as 'cvshead' in GIT, making things a lot clearer.
Importing CVS Faster
For initial imports, it is highly recommended that you fetch the CVS repository from one of Moodle cvs servers and run the initial cvsimport against your local copy of the repository.
- For the more adventurous: Keith Packard wrote another importer that does a better job at the initial import, called parsecvs. I use parsecvs for the initial import and then git-cvsimport daily for the incremental imports. --Martin Langhoff 15:04, 19 July 2006 (WST)
- It took me a few minutes to find the info in the Sourceforge docs on how to fetch the raw CVS repo via rsync. Just type 'rsync -av "rsync://moodle.cvs.sourceforge.net/cvsroot/moodle/moodle/*" .' (without the single quotes) and you'll be done --Iñaki Arenaza 17:54, 25 December 2006 (CST).
- This rsync command line doesn't work as-is anymore, since the repository was moved from sourceforge. Some mirrors (at least es.cvs.moodle.org at this time) provide rsync, but some don't (like eu.cvs.moodle.org). Find the best mirror for you and update the rsync call accordingly.
After the initial import, you can run git-cvsimport against your favorite cvs.moodle.org mirror repository, or update your local copy via rsync as sas demonstrated in this script.