Quick Drupal version control with Bazaar

We all have the Drupal projects we work on that ought to be under some sort of version control system but aren’t. There are many reasons why this might be the case: the small size of the project, the lack of central version-control infrastructure, or the annoyance of “.svn” or “CVS” directories littering your working copy.

With Bazaar, none of these excuses should prevent a project from having solid version control.

Here’s why Bazaar avoids those problems:

  • It requires minimal effort to bring code under control.
  • Bazaar does not require (but still supports) centralized infrastructure.
  • A single .bzr directory at the root of the project contains everything Bazaar needs, minimizing disruption.

Bringing a Drupal project into Bazaar

Note: If you want to automate your Drupal updates, you may want to branch from the Four Kitchens repository instead of initializing your own branch. Branching from the Four Kitchens repository is more time consuming, but it’s worthwhile for large projects.

  1. Install Bazaar.
  2. Go to the root directory of your project.
  3. bzr init
  4. bzr ignore ./files # Drupal 5 only
  5. bzr ignore ./sites/default/files/ # Drupal 6 only
  6. bzr ignore ./sites/default/settings.php
  7. bzr add
  8. bzr commit -m “Initial import”

That’s it! Learn to use Bazaar and enjoy powerful version-control capabilities for even your smallest projects.

Comments

…just tell me if anyone at Four Kitchens wants to volunteer for writing a Bazaar backend for Version Control API :P

I’m certainly interested.

I’m new to Version Control and interested in using Bazaar. I follow your tutorial on using Bazaar to track Drupal file revision. Thanks!

I’m also wondering about how to track changes in the Drupal database. For example, is there a way to have Bazaar monitor revision to the database in case I screw something up. I would like to be able to roll back the changes to the database if something goes wrong with an update, etc.

Specifically, I’m wondering how Bazaar would monitor the database under my MAMP local server environment.

Thanks!

You could version dumps of the database, but Bazaar (and every other VCS) is not very good at versioning the database table file(s) directly.

I’m investigating the best vcs for my drupal projects. Any resources to consider. Seems like you guys like Bazaar.

Thanks****

Why have you told bzr to ignore default/settings.php? I can think of a few reasons to track it, esp. if using something like cacherouter that requires mods to that file.

Are you assuming multi-site? (then it might make sense - default/settings.php might never see changes) If you are not, then do you have any insight re. how to change your method for a multi-site install?

Thanks!
-Mike Waters

Contact Four Kitchens

Download Pressflow

Pressflow makes Drupal scale