My merry five minutes with Bazaar

4 June 2007

After `OpenBSD failed the five minute test`_, can Bazaar be usable within 5 minutes?

Backup upon Backup

I have been writing my latest little Python program and it has accidentally become not so little. So I have been backing the directory up before making changes each little coding session. Now I have 15 or so old directories, and if I need to go back and see what I have done, and at some point I will, then it would be a little dull to try to grep my way through them.

So I decided to use a source control management system. I strongly dislike CVS and Subversion, for reasons I can explain another time, and for another project I have been using hg (also known as Mercurial), so I was just going to use that. This time, however, I decided to use Bazaar, not least because if I ever get the code to a point where I am willing to share it, then I will probably upload it to my launchpad.net thingie, as I find Sourceforge pretty horrible to use.

My two minutes with Baz

To install programs is a bit operating system specific of course, but on Gentoo Linux you just have to type:

emerge bzr

Note, that confusingly enough, it is not the package 'bazaar' - that is an old deprecated program that does not share code and has a different set of features. That tripped me up as I was using the wrong program to start with. Hopefully the Gentoo maintainer who I ran into will make it more clear. So that used up the first two minutes.

Fortunately, the correct Bazaar is so user friendly that I easily did the rest in three minutes. I subsequently learned that Bazaar folks call the new one bzr and the old one baz. Both programs were written by the same people, they seem to have simply downed tools on the old one then wrote the new one. There seems to be no good reason to use the unmaintained old one, and many good reasons to use the new one. Anyway, enough of this, lets move on.

My Three Minutes with Bzr

So I followed the relevant bits of the handy tutorial. Firstly I set up my name and email address. Which I have cunningly obfuscated so I get less spam (my email address is easy to figure out if you are a real human).

bzr whoami 'Command Line < warrior@localhost.com >'

Then I went to my folder with my code in and blessed it with holy penguin pee:

bzr init

This made a folder called .bzr which will contain the history and other control data. You are meant to ignore it and leave this alone. Then I could run:

bzr status

This showed all my files as 'ignored', since none are currently being watched by bazaar. Next I did:

bzr add *.py

So at this point, all of my Python files are being watched by the system, and all other file types are unknown. Cleverly, it automatically ignored all the compiled Python bytecode files (.pyc) which I would never want to track.

So the manual says "There are three classes of file: unknown, ignored, and versioned". My Python source files are 'versioned' (yes they make up words!), while my compiled python files are ignored and my other files are unknown to the system.

Next up I added another file, and was ready to make my first commit. I used -m to add a message:

bzr commit -m "added my initial files"

That's all there is to it really, (I am sure there are lots of other features I do not need). A rather nice thing is that you can use normal filesystem commands without messing up the system and no need for some horrid database. If I want to stop Bazaar from tracking a file then I can use:

bzr remove oldfile.py

Or alternatively I can just delete it using rm.

Bazaar VS Mercurial

I am pretty happy with both so far. I will probably use Bazaar for new projects at the moment as it seems a tiny bit more user friendly.

Having said that, the commands seem very similar, so I do not know why the world needs both? They are both in Python, both under the General Public Licence and they both do the same job. It seems a bit weird to have two.

While the new kid on the block, Bazaar seems to be well liked by hobbyists like me and groups at the 'community' end of the open source world, while hg seems to be more liked by the large corporate projects. So to take two examples, Ubuntu uses Bazaar for its' projects, while Solaris uses hg. Zope uses Bazaar while Java uses Mercurial. Yes the code to Java is maintained in a Python application, I can't say that I'm surprised, while Java has taken over the world in terms of people than can use it, it is still not fast at all in certain circumstances.

The performance benchmarks out there seem pretty dated but seem to favour hg over bazaar for ridiculously large projects (i.e. several gigabytes), however if high performance with a giant codebase over user-friendliness is your bag then you really want to be looking at git which is out in front (with hg in second and proprietary tools are way-way down the list).

Those benchmarks are irrelevant for me when 20 files is a pretty massive program. Also all projects are different, so no one system will win them all. I think it may be a couple of years still until the plates stop spinning and we can see who wins the distributed SCM world; in the centralised SCM generation, CVS eventuality became the dominant standard tool.

Other interesting things to look at would be graphical front-ends, Emacs plugins, and so on; but at this point, I can now manage my little project, so Bazaar passes the five minute test.

1 Daniel says...

I've been using Bazaar for a few small projects and I've really liked it. Once I wrapped my head around it I've really grown to like decentralized source control over traditional CVS/SVN models. I haven't had a reason to play with Mecurial yet, as the code base for those projects is relatively small compared to the stuff I've been doing for work. I will say that Bazaar's ease of renaming and changing directory structure is great when you're first starting a project and still revising the layout.

One of these days I'll probably convert some of my work code to a DSC system, just to play with Bazaar or Mecurial with a larger project, but SVN is just fine for that right now.

Posted at 2:57 a.m. on June 5, 2007


2 DG says...

Hi, thanks for the intro to bzr etc...

some questions :

  1. I presume bzr behaves the same as svn/cvs, in that if you 'rm $file'

    first, it will restore it when you next do a 'bzr update' ?

  2. Have you looked into finding any web interfaces (like trac) for bzr?

We use subversion at work, and it works very well with trac. Because of this there is no way we could ever change, unless trac supported bzr (having said that, a quick google comes up with https://launchpad.net/trac-bzr ).

Tried branching / merging yet?

Posted at 7:21 a.m. on June 5, 2007


3 Zeth says...

Hi everyone,

Hi Daniel,

Yeah, thanks for that, I did not really have time to talk about why decentralised SCMs suck a whole lot less than CVS, SVN etc, but I am squarely in the decentralised camp.

Dave,

  1. Well in the situation given above where it is just my code, when you

    rm filename.txt, then it is gone, it does not come back. You can however recreate it with bzr revert filename.txt

However, if I was tracking another upstream source, then if I used bzr pull to pull down the changes, then it would come back if it was still upstream. However, I would merge rather than pull I suppose, otherwise I would lose what I had done to the code.

  1. I haven't really yet (that did not fit within the five minutes). One

    nice thing is that you do not have to, being a distributed SCM, means that you can push a copy out to a third-party service such as Launchpad and have them worry about it.

Apart from that, I guess there are lots. A quick Google brings up these: http://www.lag.net/loggerhead/ http://goffredo-baroncelli.homelinux.net/bazaar

Phill

Maybe, I guess I am just annoyed with Java at the moment because in my day job we were forced to move to this proprietary Java based web framework which is as slow as hell, really awful.

Posted at 8:51 a.m. on June 5, 2007


4 Daniel says...

Why did you never consider GIT? Kernel an more and more OS use it. I love it for smallest to big project and even convert CVS/SVN projects to git for me at home.

Daniel

Posted at 6:28 p.m. on June 8, 2007


5 Bob says...

I second Git

Here is a funny talk by Linus himself on why he wrote Git because nothing else does what he needs.

http://www.youtube.com/watch?v=4XpnKHJAok8

ps, Git is not an acronym. It's British slang for a b*std

Posted at 5:22 p.m. on June 18, 2007


6 dbr says...

"Yes the code to Java is maintained in a Python application" I'm not sure I'd use a source-control application that's written in the language I'm currently developing. What if there's a bug that screws up the java-vcs command and won't let you push your fix? :P

I've been using darcs for tracking local changes (Kind of as a less-temporary undo) - basically because it has a nice interactive command-line interface, then when I get to a ~complete stage, I commit it to a remote SVN server for syncronization between multiple machines, and as a backup..

I've been meaning to play with bzr or hg.. I tried Git, but it was horribly convoluted. Installing it created about 150 files in /usr/local/bin/, some of them binaries, some of them shell-scripts, some of them aliases, some of them perl scripts, and it also required a few perl modules.

If you get the time, it'd be interesting to read a comparison between bzr and mercurial(hg)

Posted at 2:46 a.m. on February 25, 2008


What do you have to say?

Show Editing Help

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

Essex Web Design

September 3, 2010
A lot of contract providers give you free internet usage now, but if you have Pay As You Go, then you are going to be paying heavy prices.
Calling time on mobile internet nonsense?

Krasochka

September 2, 2010
Hack again?!
Adding more terminals to your function keys

GenryFlorist

September 2, 2010
<b>Cheap flowers delivery around the world!</b> Celebrate summer with our gorgeous flowers. They?re the perfect gift for any summer occasion. From birthdays to anniversaries, we offer beautiful flowers, lush plants, ...
Burning an iso to CD on Windows

auto-financing.co.cc

September 2, 2010
auto-financing
ReStructuredText tables and doctests

rubaxa

September 1, 2010
FTP = NOT RANDOM software Dominated hands postflop suckout often on all-ins. EX. AK vs. A9 or KQ vs. K6. Both players hit top pair. Bad player goes all in ...
Burning an iso to CD on Windows

empodayaddelm

September 1, 2010
Sorry admin - my post is test
This Week: Heroes and Monsters

increase synthroid dosage

September 1, 2010
Latest world news: 1 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/viagra-cialis-buy-no>buy cheap cialis generic levitra viagra</a> Viagra 2 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/buy-viagra-online-at-lowest>rainbowpush discussion board buy viagra</a> Viagra 3 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/how-to-get-generic-brand>search viagra ...
SFTP in Python: Paramiko

Lacilslaw

September 1, 2010
HYUN JAIMIE enniless and homele JAMILA
This Week: Heroes and Monsters

domaserisk

August 31, 2010
who was shaking his head back and forth knowingly Grissom shifted his eyes over at Brass,
How I Removed Windows from my Laptop

get ready loan

August 30, 2010
Though, by the you kill the legitimate PC user from visiting the site. Also, think about the dynamic IP's issue.
Only the penitent man will pass - on captchas and cotton wool

Packers and movers in pune

August 30, 2010
The topic you disscussed here is very amazing, informative and useful in future...
On Comment Spam

serhanters1

August 30, 2010
?? ???????? ??... ??????...... ??. ????????? ??? ??? ???????D ???????? ??. ????? ????? ???? ??? ???=) ?? ?????- http://letitbit.net/download/8746.894a84bc20f38f1661895aeee0/stereokartinki.html ???http://f-zona.ru ? ? ?? ????????????
Burning an iso to CD on Windows

strona startowa

August 29, 2010
Thanks For This Post, was added to my bookmarks.
Python CGI contact forms

lerexottori

August 29, 2010
?????????????? ??????????
Adding more terminals to your function keys

KelpAugmeme

August 29, 2010
aofaapsymp, http://forums.quark.com/members/jennaq.aspx online stock trading broker, rdgofzary
PuTTY Series: Adding PuTTY to your system path

Cheeday

August 28, 2010
What flowers do you like?
This Week: Heroes and Monsters

magfcvb

August 28, 2010
??????? ?????????????? ?????? - ????? ?????? ?????????????? ??????, ?????????????? ?????? ???????, ?????????????? ?????? crosman, ???? ??????????????? ??????, ?????????????? ?????? ?????? ????????. ???? magazin-oruzhie.ru
Include ODF support in the Linux Standard Base?

noni

August 28, 2010
I find myself coming to your blog more and more often to the point where my visits are almost daily now!
On Comment Spam

Latenadsfes

August 28, 2010
http://mynewblog.for-breastcancer.com/ http://mynewblog.photoblogcentral.com/ http://ilovezebras.thechicks.org/ http://mynewblog.cyberbardsymposium.com/ http://wewphost.com/ilovezebras/
Burning an iso to CD on Windows

LeupoldEst

August 28, 2010
pretty cool stuff here thank you!!!!!!!
OOXML Vote Coverage