Go directly to workshop page for Leveraging Drupal

My own version of Tim Millwood's "Streamline Drupal CVS checkout" script

I just changed two things (I am on Ubuntu with bash shell) in relation to Tim Millwood's excellent bash script (see http://millwoodonline.co.uk/streamline-drupal-cvs-checkout ).

1) Put the functions in .bashrc instead of .profile so I could see the changes immediately (.profile gets loaded via login, not just by opening a new terminal screen).

2) Modified the function getmod() to be able to check out contrib mods to a sensible directory. Since the drupal checkout creates sites/all but not sites/all/modules or similar, so there is no CVS meta info if I create the sites/all/modules directory and try the function getmod there. It won't work. So I modified getmod() so that I could execute all commands right from the Drupal document root directory. That way, I could do the following

~/tmp$ mkdir drupal
~/tmp$ cd drupal
~/tmp/drupal$ getdrupal 6-10
...

and then, without changing directories, do:

~/tmp/drupal$ getmod cck 2-2
cvs checkout: Updating sites/all/modules/contrib/cck
U sites/all/modules/contrib/cck/CHANGELOG.txt
U sites/all/modules/contrib/cck/DEVELOPER.txt
U sites/all/modules/contrib/cck/README.txt
U sites/all/modules/contrib/cck/UPGRADE.txt
...

Here is my modified function getmod() which specifies the "sensible" contributed modules directory that I always use these days. Notice that CVS creates all the intervening directories and inserts CVS meta data in each one.

function getmod () {
MODULE="${1}";
VERSION="${2}";
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib co -r DRUPAL-6--$VERSION -d sites/all/modules/contrib/$MODULE contributions/modules/$MODULE;
cd sites/all/modules/contrib/$MODULE;
getrevs $MODULE.module
}

The complete listing as I use it in .bashrc:


function getmod () {
MODULE="${1}";
VERSION="${2}";
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib co -r DRUPAL-6--$VERSION -d sites/all/modules/contrib/$MODULE contributions/modules/$MODULE;
cd sites/all/modules/contrib/$MODULE;
getrevs $MODULE.module
}
function getrevs() {
cvs log "${1}" | egrep 'DRUPAL-.*:' | sort
}
function updatemod(){
cvs update -r DRUPAL-6--"${1}" -dP
}
function getdrupal(){
FOLDER=${PWD##*/};
cd ..;
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -d $FOLDER -r DRUPAL-"${1}" drupal;
cd $FOLDER
}
function updatedrupal(){
cvs update -r DRUPAL-"${1}" -dP
}

Added to DrupalSightings.com