Revision of Vendor Branches for Modules from Mon, 11/03/2008 - 11:28

Revisions allow you to track differences between multiple versions of your content, and revert back to older versions.

Use Subversions "vendor branch" capabilities for managing Drupal module installation and updating.

Ross Burton's Vendor Branches in Subversion is a decent explanation of how vendor branching works.
CodeGobbler has an article on SVN repository structure for Drupal projects that includes using svn:externals for modules.

Adding a module to your local Drupal repo
Check out a copy of the module section of your local Drupal SVN repo:

cd /tmp
svn checkout file:///var/svn/drupal/modules modules

Within the checked-out copy, create folders for a modules. We'll use the Update Status module as an example:

cd modules
svn mkdir update_status
svn mkdir update_status/current

Commit your changes back to the repository:

cd /tmp/modules
svn commit -m "Added update_status module structure."

The checked-out copy of the modules folder can be deleted at this point:

cd /tmp
rm -rf modules

Now download and untar a release of the module:

cd /tmp
wget http://ftp.drupal.org/files/projects/update_status-5.x-2.2.tar.gz
tar zxf update_status-5.x-2.2.tar.gz
rm -f update_status-5.x-2.2.tar.gz

Normally, when you untar a Drupal module, the resulting directory name doesn't contain the version number. However, in our case we're going to want it to contain that detail:

mv update_status update_status-5.x-2.2

We'll use the svn_load_dirs.pl script to load the module into current:

svn_load_dirs.pl file:///var/svn/drupal/modules/update_status current update_status-5.x-2.2 -t update_status-5.x-2.2

Install the module to your site
Navigate to where you want to add the module (sites/all/modules or sites/sitename/modules). If the folder doesn't exist, create it. Eg:

cd /var/websites/projectname/htdocs/sites/all
svn mkdir modules

Copy the module to the checked out site:

cd modules
svn export http://<your_svn_server>/svn/drupal/modules/update_status/current update_status
svn add update_status

Upgrading the module
Download the new module version:

cd /tmp
wget http://ftp.drupal.org/files/projects/cck-5.x-1.9.tar.gz
tar zxf cck-5.x-1.9.tar.gz
mv cck cck-5.x-1.9
rm -f cck-5.x-1.9.tar.gz

Load the new version into current:

svn_load_dirs.pl file:///var/svn/projectname/vendor/modules/cck current \
/tmp/cck-5.x-1.9 -t cck-5.x-1.9

Merge the new current version of the module with your working copy in trunk. Using merge instead of copy in case you've made any changes to the version in trunk.

cd /var/websites/projectname/htdocs/sites/all/modules
svn merge file:///var/svn/projectname/vendor/modules/cck/cck-5.x-1.6-1 \
file:///var/svn/projectname/vendor/modules/cck/current \
cck

Commit the update into your repo:

svn commit -m "Merging CCK 5.x-1.9 into trunk"

Recent Updates

  • 2 years 3 weeks ago
  • 2 years 3 weeks ago
  • 2 years 3 weeks ago
    php 8.x
  • 2 years 3 weeks ago
    10.6.7
  • 2 years 4 weeks ago
    Drop Centos 5/6 stuff