Checking Out from the Main Repository

Accessing the files using the web interface

There are two ways to access the latest Drupal sources in the main CVS repository. For a quick look at some core or contrib files, use the ViewCVS web interface. To get a local copy of the complete source tree to study and work with the code checkout a full version of the codebase with a CVS application.

Make sure you have the latest version of CVS app

Linux users should have a CVS program already installed by default. If you don't, install a recent copy of CVS.

Mac users need to get the latest version of Xcode Tools from the Apple Developer's website, or check out the Concurrent Version Librarian: point and click CVS site. There is also a Handbook page with some tutorials on how to use the CVL application.

Windows users will need to download a program before trying to use CVS. There are quite a few CVS programs for Windows.

Checking Out Drupal using a bash shell

Note that CVS uses port 2401 any firewalls will need this port open in order to perform these commands.

(video demonstration)

To check out the latest Drupal source code, commonly called "HEAD", use the command:

$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout drupal

This will create a directory called drupal containing the latest drupal source tree (-z6: use gzip compression so the transfer takes less time. -d: specify the 'directory' where the files are located and how to access them).

To check out Drupal to a specific directory, such as mywebsites/drupal_head, you can place a pathname just before the final 'drupal', like so:

$ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -d mywebsites/drupal_head/ drupal

Run this command from the root of your drive! Observe the lack of a leading slash in this pathname, even though you are running it from /. Adding a beginning slash will cause errors in most cases.

It's important to understand that this will create the directories if they do not exist, so if you're not at the root of your drive when you run this one, and you don't see your newly checked out drupal instance, go and look for the site in a path relative to where you are right now. It'll be hiding there.

Other useful methods of performing the checkout are:

  • Checkout a specific Drupal version:
    $ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-5-7 drupal

    where DRUPAL-5-7 is one of the tags from the List of core branches and tags.
  • Checkout Drupal from a specific date:
    $ cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -D "31 Jan 2007" drupal
  • Using aliases to speed up checkout. If you check out often, consider adding an alias to your bash profile so you don't have to type the entire string each time. (Mac OS 10.3 (Panther) and higher defaults to bash, so treat these instructions as though they're written for Terminal.)
    Add the following line(s) to the ".bash_profile" or ".bashrc" file in your home directory.
    alias checkouthead='cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout drupal'

    alias checkout6='cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-6 drupal'

    alias checkout5-7='cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-5-7 drupal'

    The new alias is now "checkouthead" or "checkout6", or whatever other aliases you'd like to create. Whenever you need a fresh copy of drupal, cd your way into the directory where you keep all your sites, type "checkouthead", then stand back and watch the magic! You'll end up with a folder called "drupal" which you can then rename to "drupalHEAD" or "d6" or whatever you want it to be.
  • Exporting Drupal without CVS folders:

    When you do a 'checkout' it checks out all files along with CVS files and folders, which enables you to do a 'cvs update' later. Sometimes, however, you want to take a copy of the code without the CVS files, for example to import into your own CVS repository. This can be done with the 'export' command.

    An example of exporting the latest development snapshot of Drupal:

    cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal export -r HEAD drupal

    Here is an example of exporting a specific version of Drupal. In this example the "6" represents the major release and the "1" represents the security/bug release number:

    cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal export -r DRUPAL-6-1 drupal

    That will give you a copy of Drupal without any tracking information or extra data to associate it back to CVS. Note that you can, of course, export any branch or date using the above switches.

  • Keeping your HEAD in the game

    Once you have a copy of the Drupal HEAD, keeping up-to-date is simple! Use the cd command to navigate your way into your HEAD directory, and then use:

    $ cvs update -dP

    to update all files to their latest versions. The -d creates any (new) directories that exist in the repository if they're missing from your local working directory. The -P flag prunes any and all empty directories, i.e. directories that got removed in the repository will also be removed in your working copy too.

    You can also use the command:

    $ cvs -q update -dP

    to suppress informational messages related to the update (-q: quiet).

    Special Cases

    Using a HTTP Proxy

    You can add the proxy information to the checkout command. Note that you need to escape your semicolons with a backslash if you are on a Unix command line: \;.

    cvs -z6 -d:pserver;proxy=example.com;proxyport=8080:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout drupal

    Logging in under tcsh

    The above commands will not work at all for many users running tcsh with older versions of CVS (the login command with username:password@server doesn't work at all, for example.) Here is the proper method for connecting in such situations:

    > setenv CVSROOT ":pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal"
    > cvs login
    (Logging in to anonymous@cvs.drupal.org)
    CVS password:
    > cvs co drupal

     
     

    Drupal is a registered trademark of Dries Buytaert.