Using CVS to Upgrade a Drupal Site

Posted by Jeffrey Scott of TypeHost | Monday, September 8th, 2008
, , ,

If you have many Drupal sites under development, it may become quite difficult dealing with the frequent security upgrades that are released. Learning to use CVS commands can simplify this process considerably. CVS or Concurrent Versions System is a predecessor to Subversion.

As Collins-Sussman wrote in Version Control with Subversion:

“In the world of open source software, the Concurrent Version System (CVS) has long been the tool of choice for version control. And rightly so. CVS itself is free software, and its non-restrictive modus operandi and support for networked operation – which allow dozens of geographically dispersed programmers to share their work – fits the collaborative nature of the open-source world very well. CVS and its semi-chaotic development model have become cornerstones of open-source.”

CVS Commands:

The following line will install drupal 5-10 into dir drupal-5 from your current location.
(if you execute it from /www then it will install to /www/drupal-5/ )

/opt/csw/bin/cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -d drupal-5 -r DRUPAL-5-10 drupal

The following line will install drupal 6-4 into dir drupal-6 from your current location:

/opt/csw/bin/cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -d drupal-6 -r DRUPAL-6-4 drupal

To install a module, i.e. Views:

/opt/csw/bin/cvs co -d sites/all/modules/views -r DRUPAL-5–1-6 contributions/modules/views

To install a module, i.e. CCK:

/opt/csw/bin/cvs co -d sites/all/modules/cck -r DRUPAL-5–1-7 contributions/modules/cck

For an explanation of the above examples:

/opt/csw/bin/cvs - this is the path to CVS
co -d
sites/all/modules/views
-r
DRUPAL-5–1-7

This is important. It states the version of the module that you wish to check out. if you were for example to replace DRUPAL-5–1-7 with DRUPAL-5–1-6 it would check out version 5–1-6 not 5–1-7.

contributions/modules/cck

This is the cvs path to the version ( DRUPAL-5–1-7 ) that you wish to checkout.
See: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/cck/
It is simply the path from the end of the url, reflected online from CVS path.

run from dir /www/drupal-5/sites/all/modules/cck
/opt/csw/bin/cvs update -r DRUPAL-5–1-7 –dP

Setting up the Drupal Installation:

To install CCK for drupal 6 run this command from the drupal-6 root dir, i.e. /www/drupal-6 (run from there as the path is already included in the syntax, sites/modules/all)

CVS checks out (downloads) the requested module to wherever the syntax tells it to: sites/all/modules/cck

/opt/csw/bin/cvs co -d sites/all/modules/cck -r DRUPAL-6–2-0-RC4 contributions/modules/cck

Another example, once more executed from /www/drupal6/

/opt/csw/bin/cvs co -d sites/all/modules/views -r DRUPAL-6–2-0-RC1 contributions/modules/views

This has of course checked out the views module from the CVS repository, version 6–2-0-RC1 and put it into /contributions/modules/views for us.

How to Install a Theme:

Go to the drupal-6 root dir /www/drupal-6

To install the Refresco theme:

Navigate through the CVS repository to find the most recent stable release. http://cvs.drupal.org/viewvc.py/drupal/contributions/themes/refresco/ from there you can find the latest stable is 6–1-1

Note: that the source and destination paths have changed from modules to themes in the following syntax.

/opt/csw/bin/cvs co -d sites/all/themes/refresco -r DRUPAL-6–1-1 contributions/themes/refresco

Thanks to Andy at Touch & Click for providing this information – hopefully it will be of use in saving some time for those who have to upgrade Drupal on a regular basis.

For more information, see:
http://drupal.org/handbook/cvs
http://drupal.org/node/320

Related Posts