Bazaar is like git. If you have a copy of a branch in Bazaar then you can commit to it without getting permission from anyone. This kind of makes sense. If the branch is on your hard drive, then you should be able to commit to it!

There are a few rules to follow to making local commits:

  1. You will want to commit your work from time to time. This is performed with
    bzr commit -m "A description of your changes"
    
  2. If you add a new file or directory to your drupal branch then you'll want to run
    bzr add <newfile>
    
  3. If you want to take a file or directory out of revision control, then you do so with
    bzr remove <badfile>
    

    Doing this will not delete the file, but will tell Bazaar to stop tracking it for you.

  4. You can ignore files by running
    bzr ignore <filename>
    
  5. Once you have committed to your drupal branch bzr pull will no longer work. This is because the branch is no longer strictly a copy of the official development drupal branch. Now, instead of pulling new changes, you will have to merge them.
    bzr merge
    

When you commit to a branch then those changes will stay in your branch until somebody else merges them. This means that if you want somebody to merge your code, that you'll have to put a copy of a branch in a place where other people can reach it. They in turn can either branch or merge from you. We'll cover this in a different chapter.

Database revisions

Tracking database changes can be hard. Here's an example of a script for such purposes. (It may be a good idea to keep it in revision control as well):

#!/bin/sh
rm -f database/tabs/*
mysqldump -uUSER -pPASSWORD DATABASE --opt -r database/currentdb.myqsl
mysqldump -uUSER -pPASSWORD DATABASE --skip-opt -T database/tabs
bzr add database/tabs
bzr commit

You will want to create a fold "tabs" in the database directory. Make sure that the mySQL user can edit it (with the nuclear option being "chmod 777 tabs" - a better way would be to chown it to the right user/group).

Every time you want to checkpoint your code (put the code and db in sync in version control), run this script to give yourself a picture of the entire database AND individual tables. If tables are dropped, the 'rm' takes care of that.

If you use postgreSQL, you will need to adapt this to for your system.

WARNING

Be careful. If you're serving drupal from a bzr checkout that bzr checkout can be branched from (since everything is a branch).

If the response of

bzr info http://mydrupalsite.com/

is anything other than bzr: ERROR: Not a branch: http://mydrupalsite.com/ then anyone can check out your code. Not a problem unless you happened to check in your changes to sites/default/settings.php - ie: your database password.

Not a problem though, just toss in a little .htaccess file in your .bzr/:

Order deny,allow
Deny from all

Good as new.