Last updated May 4, 2012. Created by alanburke on July 1, 2008.
Edited by lisarex, silverwing, pronky, micheas. Log in to edit this page.
Note: this will no longer work as drupal.org has migrated to git. If you need to download all the projects and branches of drupal.org see the discussion at http://drupal.org/node/1057386 for a solution. This page has been archived.
If you travel a lot, have a long daily commute, or otherwise have big chunks of time spent offline, there can be a lot of advantages to having a local copy of the core and/or contributions CVS repositories available.
Fortunately, drupal.org provides the following rsync mirrors of cvs.drupal.org:
$ rsync cvs.drupal.org::
cvsbackup
bzr
cvsmirror-core
cvsmirror-contribThese mirrors allow you to easily make a local copy of the repository that has all the version information and/or import it all into an alternate RCS, such as Subversion. You can then checkout/diff/etc. against the local repository when you are offline.
Please note that the following paths are for Mac OS X; you may need to use different paths for Unix/Linux, or create a separate user account for your repository with common group read/write permissions.
Setting up a local core repository
- Begin by creating a local CVS repository to hold the files.
$ cd /Users/Shared
$ mkdir /Users/Shared/drupalcode
$ cvs -d/Users/Shared/drupalcode init
This will initialize a new CVS repository in the /Users/Shared/drupalcode directory. - Then checkout the CVSROOT directory and edit its modules file:
$ cvs -d/Users/Shared/drupalcode co -d CVSROOT-temp CVSROOT
$ cd CVSROOT-temp
$ nano modules
From our new /Users/Shared/drupalcode repository, we are checking out the CVSROOT directory and saving it in a CVSROOT-temp directory. Then we are using the "nano" text editor to edit the "modules" file (but you can use any text editor.) - Add the following line at the bottom of the file:
drupal drupal - Exit the editor and commit your changes:
$ cvs commit -m "Add Drupal core to local repository." - If you are not going to rsync the Drupal contributions repository below, you can delete the CVSROOT-temp directory.
- Execute the following command to get rsync to grab the files from cvs.drupal.org:
$ rsync -avz --delete cvs.drupal.org::cvsmirror-core/drupal /Users/Shared/drupalcode
The -a option of rsync tells it to use a set of options best for making an "archive" of the files we are copying. The -v option tell rsync to list each file as it is copied. And the -z option tells rsync to compress the file data during the transfer to reduce the amount of time it takes to copy all the files.
You can then checkout core on any available branch or tag locally:
$ cd /Applications/MAMP/htdocs
$ cvs -d/Users/Shared/drupalcode co -d drupal-7 drupal
$ cvs -d/Users/Shared/drupalcode co -d drupal-6 -rDRUPAL-6 drupalSetting up a local contributions repository
As of February 2010, the complete drupal.org contributions CVS repository totals approximately 2.5 GB of disk space.
- If you haven't already, complete step 1 above to create your local CVS repository.
- Then checkout the CVSROOT directory and edit its modules file:
$ cvs -d/Users/Shared/drupalcode co -d CVSROOT-temp CVSROOT
$ cd CVSROOT-temp
$ nano modules - Add the following line at the bottom of the file:
contributions contributions - Exit the editor and commit your changes:
$ cvs commit -m "Add Drupal contributions to local repository." - You can now safely delete the CVSROOT-temp directory.
- Execute the following command to get rsync to grab the files from cvs.drupal.org (Note: this will take a long time):
$ rsync -avz --delete cvs.drupal.org::cvsmirror-contrib/contributions /Users/Shared/drupalcode
You can then checkout core on any available branch or tag locally:
$ cd /Applications/MAMP/htdocs/drupal-6
$ cvs -d/Users/Shared/drupalcode co -d views -r DRUPAL-6--1 contributions/modules/viewsKeeping things in sync
Once you have this setup, its nice to ensure your copy of Drupal CVS stays up to date. You can do this by executing the rsync command on a cron job. For example:
- Edit your crontab file:
$ crontab -e - Add the following lines to crontab to run the rsync command once per hour:
21 * * * * rsync -az --delete cvs.drupal.org::cvsmirror-core/drupal /Users/Shared/drupalcode > /dev/null 2>&1
21 * * * * rsync -az --delete cvs.drupal.org::cvsmirror-contrib/contributions /Users/Shared/drupalcode > /dev/null 2>&1
When you use cvs update, you will get updates based on the changes that rsync pulls down from the mirror (so they may be delayed an hour compared to updating directly against the cvs server).
Comments
Why is this page still here?
Why is this page still here?
Why is this page still
I think this page should stay because it relates to this issue: "Set up anon rsync of git repositories".
I used to use a method like this to maintain a local copy of all Drupal projects & themes. Being able to grep through them was invaluable for me when I wanted to get ideas from how others have coded things. Also, I like to have the projects available when I'm working somewhere without internet.
See also here: http://drupal.org/node/1057386#comment-5311908