Bazaar is different from a typical version control because it doesn't rely on having one centralised repository instead it operates on a de-centralised model. You can either operate with the repository stored locally, or, you can set up a centralised location for your code and then checkout a out to each developer's machine. When the changes are committed they are stored both locally and uploaded to your remote repository.
The reason why this is cool is that it means that if you like to work off-line, hack on the train for short or long periods, or your connection to the internet is just down for a time, you can continue to work and commit new revisions. When off-line you simply add a switch to you command e.g:
bzr commit --local -m "a commit message" and then your commits will be set to pending. When you are back online you run the commit again and all your off-line commits will be synchronised.
The other thing that hits home about bazaar is that it simply does not get in the way of the work you are doing. It just works as expected. Setting up branches and repos takes two secs. Really, hang on I'll prove it, read on…
For example. You've already installed Bazaar. After setting your name and email address with
bzr whoami "Your Name <Email Address>", to set-up a working branch simply navigate to that directory with your command line and then type
bzr init. Then add the files you want to version e.g:
bzr add (adds everything). Then do your first commit.
bzr commit -m "my first revision".
A shared repository
If you want to be frugal with your disk space you can use a shared repository. This then means that all of the branches you create or checkout will utilise the same area for storage. For linux/unix/mac systems a logical place would be your home directory. On windows choose a location of your choice. Maybe somewhere in "my documents" will suffice but really the choice is yours whatever the system. To do this run:
bzr init-repo --trees <directory> where <directory> is the directory you want to use.
A remote repository
Creating a remote repository for your project is pretty straightforward too.
bzr init-repo --no-trees sftp://yourhost/path/repo/ creates the repo. Next we need to initialise our project
bzr init sftp://yourhost/path/repo/project.
To do something with this branch you need to check it out to your local machine. Change directory to where you want to store your on your local machine and then run
bzr checkout sftp://yourhost/path/repo/project dev. This will create the branch in a directory 'dev' in the directory where you run the command from.
As a test create a file. e.g:
vim mytest.txt (windows users can improvise with notepad or WHY). Now you need to add the file:
bzr add. Lastly commit this file.
bzr commit -m "the first revision for project x" If all is well as you have checked out a remote branch the file will be committed both locally and the revision info (Note: Not the file itself) will also be sent to your remote repo.
If you want to you can now test this by checking out the same remote branch to another location on your system you should see the file you comitted appear in the location your checked the branch out to.
Now for a couple of useful commands.
bzr status tells you what files are modified, what files are added etc. It's a good way of checking where you are at.
bzr log will show you all of the current revisions and the comments along with who commited the branch.
Publishing a branch is totally straightforward as branches are self-contained in the directory they are created in, you only have to copy the directory to somewhere publicly accessible for the branch to be available for people to checkout. E.g http://muffinresearch.co.uk/bzr/tweetyPy/devel. The current development branch of TweetyPy. All someone would need to do to take a copy of the branch from this location is to run
bzr branch http://muffinresearch.co.uk/bzr/tweetyPy/devel.
The more and more I use Bazaar the more I love it. It's simple, it does everything that I need from a version control system and that's all there is to be said. Like the reponse to the command
bzr rocks. It sure does!