Checkout from Drupal CVS with this handy shell command
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






Nice! I use bash aliases
I add one line to my ~/.bash_profile:
alias drupal-co="cvs -d :pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -d"Which allows me to do commands like:
drupal-co views -r DRUPAL-6--2-3 contributions/modules/viewsdrupal-co modules/contrib-stable/views -r DRUPAL-6--2-3 contributions/modules/viewsdrupal-co views.2.0 -r DRUPAL-6--2-0 contributions/modules/viewsdrupal-co views.HEAD contributions/modules/viewsdrupal-co zen -r DRUPAL-6--2-0 contributions/themes/zendrupal-co somewebdocroot -r DRUPAL-6-9 drupalThis is way easier to set up and maintain than your suggestion above and more flexible too. Though it's parameters are a little more verbose.
Alternative
Either the Drush module, or these commands which I think I prefer... ;)
http://millwoodonline.co.uk/streamline-drupal-cvs-checkout
You should check out drush 2.x
It can download and install all drupal packages for you.
it's also no longer a drupal module (ie: you install it in /usr/bin or wherever)
then you can just do drush dl package-7.x , or package-7.x-1.0 , and it will put it in the right place.
if it's a module, you can just go drush enable modulename afterwards too.
drush cvs?
how should we configure drush to get it to use cvs versions? It's downloading releases only for me.
The help system for drush is great but tricky to figure out...
`drush help dl`
This prints out some examples for download modules via drush using cvs.
There is a great drupalcon video about the new Drush 2.0.
http://dc2009.drupalcon.org/session/drush-command-line-drupal-productivity
Post new comment