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.
<p>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.</p>
<p>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.</p>
<p>Hi, thanks for the intro to bzr etc...</p>
<p>some questions :</p>
<ol class="arabic">
<li><dl class="first docutils">
<dt>I presume bzr behaves the same as svn/cvs, in that if you 'rm $file'</dt>
<dd><p class="first last">first, it will restore it when you next do a 'bzr update' ?</p>
</dd>
</dl>
</li>
<li><p class="first">Have you looked into finding any web interfaces (like trac) for bzr?</p>
</li>
</ol>
<p>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 <a class="reference external" href="https://launchpad.net/trac-bzr">https://launchpad.net/trac-bzr</a> ).</p>
<p>Tried branching / merging yet?</p>
<p>Hi everyone,</p>
<p>Hi <strong>Daniel</strong>,</p>
<p>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.</p>
<p><strong>Dave</strong>,</p>
<ol class="arabic">
<li><dl class="first docutils">
<dt>Well in the situation given above where it is just my code, when you</dt>
<dd><p class="first last">rm filename.txt, then it is gone, it does not come back. You can however
recreate it with bzr revert filename.txt</p>
</dd>
</dl>
</li>
</ol>
<p>However, if I was tracking another upstream source, then if I used <em>bzr pull</em>
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.</p>
<ol class="arabic" start="2">
<li><dl class="first docutils">
<dt>I haven't really yet (that did not fit within the five minutes). One</dt>
<dd><p class="first last">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.</p>
</dd>
</dl>
</li>
</ol>
<p>Apart from that, I guess there are lots. A quick Google brings up these:
<a class="reference external" href="http://www.lag.net/loggerhead/">http://www.lag.net/loggerhead/</a>
<a class="reference external" href="http://goffredo-baroncelli.homelinux.net/bazaar">http://goffredo-baroncelli.homelinux.net/bazaar</a></p>
<p><strong>Phill</strong></p>
<p>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.</p>
<p>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.</p>
<p>Daniel</p>
<p>I second Git</p>
<p>Here is a funny talk by Linus himself on why he wrote Git because nothing
else does what he needs.</p>
<p><a class="reference external" href="http://www.youtube.com/watch?v=4XpnKHJAok8">http://www.youtube.com/watch?v=4XpnKHJAok8</a></p>
<p>ps, Git is not an acronym. It's British slang for a b*std</p>
<p>"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? <img src="/static/forum/img/smilies/tongue.png"></p>
<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..</p>
<p>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.</p>
<p>If you get the time, it'd be interesting to read a comparison between bzr and
mercurial(hg)</p>