Kash Farooq's software development blog

.NET Developer

Getting started with Bazaar Source Control

Posted by Kash Farooq on September 14, 2009

Following on from moving away from subversion, here are some instructions to get you up and running with Bazaar on Windows.

These instructions are generic for any type of file you want to put into source control – however there are one or two Dev Studio/ReSharper/.NET specific comments.

Install it

First, let’s install it. I installed bzr 1.18-1 Windows Standalone Installer. I unticked TortoiseBZR – you don’t need it! And I let it add BZR to my PATH.

Create a repository

I created a BZR repository “trunk” on my USB pen drive (mounted as f:).
Open a command prompt and then run the command:

bzr init f:\bzr_repo

Create a personal branch

Do a “checkout” of this repository. In BZR speak, I’m creating a personal branch:

bzr branch f:\bzr_repo c:\dev\bzr_branch

This command created the directories for me.

Add some files

Now you can add some code to your local branch. I exported all my code from my subversion repository into c:\dev\bzr_branch.
Open a command prompt at c:\dev\bzr_branch and run the command:

bzr add

This added all my code to my local change set. I haven’t touched the trunk on my USB drive.

Commit your file adds

To do a commit, issue the command:

bzr commit

Notepad pops up for me to add some commit comments. Saving the file commits the added files to my local branch.
I still haven’t touched the trunk on my USB drive.

Push your commit to the trunk

Finally, you can send your change set to the trunk on your USB drive:

bzr push f:\bzr_repo

You only have to add f:\bzr_repo for your first push. For subsequent push commands, it uses the last push location provided.

Now we can make some code changes

Go ahead and change some code, add some files, compile and then run the command:

bzr status

It shows you all the files that you have amended. Unfortunately it also shows you files and folders that you don’t want to commit to source control (obj, bin, ReSharper, etc).

Ignoring files

You can ignore files and folders with the .bzrignore file.

Push your changes back to the central repository

Now that you have ignored files that you don’t need to commit, running the following commands adds the files you do want and commits them locally (with notepad popping up) and then pushes them to your trunk.

bzr add
bzr commit
bzr push

This article should get you going. I’ll be writing a few more blog posts to discuss merging, renaming files and integrating with a subversion trunk.

Advertisements

2 Responses to “Getting started with Bazaar Source Control”

  1. Simon Reeve said

    Nice, clear post – thanks. I too am sick to death of svn mashing up my changes every time I do a merge, and corrupting my branches for no apparent reason. May well give bzr a go (though it’ll take a very, very long time to convince the office to make the move).

    • kashfarooq said

      I will soon be posting how to leave your trunk with Subversion, but have BZR branches. Then, at the end of development on the branch, you can use BZR to push your changes back into your Subversion trunk. That’s what I’ve started doing at work, and we’re on to our third project working this way.

Sorry, the comment form is closed at this time.

 
%d bloggers like this: