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

Europython

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

gutes Qualitätscasino

July 3, 2009
The paragraph is the most basic block in a reST document. Paragraphs are simply chunks of text separated by one or more blank lines. As in Python, indentation is significant ...
An Introduction to ReStructuredText

sreejith

July 3, 2009
I want to download a file from remote server in binary format. Can anyone let me know the command to do so? Thanks in advance
PuTTY Series: Using PSFTP

jythlkedl;rg

July 2, 2009
????? ??? ????????? ?????? ?? ???????? ? ????????? ???, ? ??????? ??? ??????? ??????? ? ??? ?? ???? ?? ?? ????? ???????????????? ??????????????????. ??????????????????? ????? ?? ?? ????, ?, ???, ...
Burning an iso to CD on Windows

gbi-service-ru

July 1, 2009
???? ?????????, ?????????? ?? ?? ? ???"??? ??????, ?????????? ??? ?? ???? ? ????, ? ? ?????. ?? ??? ???? ???? ??? ???. ?? ?????????? ???? ?? ?. ???????? ?, ...
Burning an iso to CD on Windows

seo techniques

July 1, 2009
I would like to thank you for the inforamtion you have put on this article no matter.
Only the penitent man will pass - on captchas and cotton wool

Online Craps lernen

July 1, 2009
I would like to thank you for the making these clarifications in such a detailed manner to rebuilt the communication and enhancing the strategies of the organization which could be ...
Disclaimer: NO WARRANTY

ZK@Web Marketing Blog

July 1, 2009
Django is an amazing web framework; we built a lot of features in a very short period of time and Django [mostly] stayed out of our way. Last night as ...
Baby Steps with Django - Part 4 Django Applications and flow

overnight payday loans

July 1, 2009
I found commandline.org.uk very informative. The article is professionally written and I feel like the author knows the subject very well. commandline.org.uk keep it that way.
Only the penitent man will pass - on captchas and cotton wool

Drogo

June 30, 2009
Gotta agree with your sentiments about many modern games. The cost of a new game is prohibitive, especially for consoles (although I've noticed that PS2 games have crashed in price ...
Retro British Gaming - Part 3: Amstrad CPC Games

pppiohooddd

June 29, 2009
Free vadult video site! http://crech.us/ 1000 free video every day!
OpenSolaris, Gobuntu, and be careful who you kiss

Tesyimasystus

June 29, 2009
...Love this dude!!! http://www.esnips.com/doc/79c22395-7bd6-4299-92db-cf392e381698/kutiman---this-is-what-it-became Peace
5 Homebrew Python Games

Simon Tite

June 28, 2009
twitterfall is still there, I just tried it, and to me it beats Visible Tweets hands down. Problem with Visible Tweets: * Extremely **irritating** animations! (There are three available, but ...
Visualising your favourite keywords in Twitter

piffAltetle

June 28, 2009
??? ??? ???? ???????????? ??????,?????????? ???? ?????? ??????????? ???????,??????????? ????? mp3,??????? ??????????? ??????.
Encrypt your /home this Christmas: part three - moving your data to the encrypted partition

idhyougjdsyhfr

June 26, 2009
SMS Trap is something that never fails to help you get your partner off guard? Our software will make reading other people?s SMS as easy as ABC. Ready for some ...
Burning an iso to CD on Windows

Sozdanie-saitov-com

June 26, 2009
???? ???????? ? ?????????????????? ????????????? - ??? - ???? ?? ????? ?????. ???? ?? ??? ? ??????? ?????? ????????? ?????! ???, ?????23126 sozdanie-saitov.com@mail.ru
Burning an iso to CD on Windows

gameskillz

June 26, 2009
Killzone 2 - the best PS3 game yet?Still LittleBigPlanet for me, but Sony's new shooter is mightily impressive. What you think about my web? http://www.easyfaxlesspaydayloan.com/payday-loans-online.html
Email Syntax Check in Python

Anish

June 25, 2009
hey Moritz, Check this http://commandline.org.uk/python/my-merry-five-minutes-with-bazaar/
Setting up a bazaar server

gbi zavod 177

June 24, 2009
???? ?????????, ?????????? ?? ?? ? ???"??? ??????, ?????????? ??? ?? ???? ? ????, ? ? ?????. ?? ??? ???? ???? ??? ???. ?? ?????????? ???? ?? ?. ???????? ?, ...
Burning an iso to CD on Windows

vettone

June 24, 2009
??? ????? ????? ????,??????? ?? ???,????? ???? ???.????? ?? ??????????? ????,?????????? ?????? ???????? ?? ????.???? ????????: http://euro-football.ucoz.com ????? ???? ??????????.
Burning an iso to CD on Windows

tuegjhg78kjfhuey

June 23, 2009
? ???????????????? ???? ??? ???, ?? ?????? ?? ?????????, ???, ???????????????? ??? ??????????, ???? ????? ??? ??? http://remont.ucoz.ua/
Burning an iso to CD on Windows