Checkout from Drupal CVS with this handy shell command

Drupal CVS
Matt Klein
Matt Klein

As noted in Jody's blog-post regarding this same subject, there are a number of tools out there which allow for simple cvs checkout from Drupal's repository. Unfortunately, they need to be installed separately for each website, which can be a pain.

Rather than continue the tedious task of looking up cvs commands everytime I want to checkout a drupal theme or drupal itself, I updated Jody's drcvs command to allow for more than just module checkout.

How to set it up:(Tested on Mac and Ubuntu)

  • Open a new Terminal, navigate to the /usr/bin folder cd /usr/bin
  • Create a new text file called 'drcvs' with some command line text editor( vi, vim, mate, emacs, etc... ) vi drcvs Note: if you are not the root user, you may have to use 'sudo vi drcvs'
  • Paste this code into the new file: #!/bin/bash if [ $1 == -t ] then cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r $3 -d $2 contributions/themes/$2 elif [ $1 == -d ] then cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -d $2 -r $3 drupal elif [ $1 == -l ] then export CVSROOT=:pserver:$2@cvs.drupal.org:/cvs/drupal-contrib cvs login else cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r $2 -d $1 contributions/modules/$1 fi
  • Save the file (in vi, or vim type ':wq').
  • To prevent getting 'permission denied errors', you can then run the following commands at the shell prompt: cd /usr/bin sudo chmod 755 drcvs

How to use the command at the shell prompt:

  • Checking out a module drcvs "module-name" "tag"
  • Checking out a theme drcvs -t "theme-name" "tag"
  • Checking out drupal drcvs -d "local-folder-name" "tag"
  • For module maintainers - make the Drupal contributions repository your CVS root and login with CVS account. drcvs -l "user-name"

Examples:(You'll need to look up the tags from drupal.org. You'll also need to navigate to the folder within which you want the module/theme/drupal to be placed.)

  • Checkout version 5.x-1.6 of the views module: drcvs views DRUPAL-5--1-6
  • Checkout version 6.x-1.0 of the zen theme drcvs -t zen DRUPAL-6--1-0
  • Checkout the latest version of Drupal into the folder examplesite drcvs -d examplesite HEAD
  • Set your CVSROOT to the Drupal contributions repository and CVS login using cvs_username drcvs -l cvs_username
Matt Klein
Matt Klein

Software Architect

Matt first began programming while in high school and continued into college. He received his Master’s in mathematics at Rutgers-Camden, where he focused on the mathematical applications of computer science in cryptography. Matt joined Zivtech in November 2008 and works on many of our large projects - such as USENIX.org - as a Senior Developer.

Ready to get started?

Tell us about your project