Posts Tagged ‘hg’

BitBucket Project for Python FusionCharts Code

Wednesday, April 8th, 2009

After my last post on FusionCharts, someone was nice enough to e-mail me some a Django snippet for exporting FusionCharts as images, so I decided I might as well put the code in a public repository.

While I prefer Bazaar out of all the DVCSes, it seems Mercurial has captured the hearts and minds of the Python empire, so I created the python-fusioncharts project on BitBucket.

If you use Python and FusionCharts, I’d love to add more snippets!

Bazaar: DVCS for Dummies

Thursday, February 26th, 2009

I like Bazaar (bzr). It doesn’t make me popular in the Mercurial-centric Pythonosphere. It doesn’t make me a 1337 über hacker like git would.

However, it does meet the most important criteria: It just works for me.

Now for the big disclaimer: Most of the projects I use bzr to manage fall into 1 of 2 categories:

  1. Projects with small teams (1-4 developers)
  2. Public projects where I just want to grab the source and maybe maintain some local patches

If I needed to somehow manage a project with dozens or hundreds of contributors (like Gnome or the Linux Kernel), git would probably look a lot more appealing to me. After all, it was designed for large code bases with lots of contributors and branches.

I’ve seen lots of git cookbooks popping up lately, so I thought I’d explain my bzr workflow for the 2 use cases I list above.

1. Starting and sharing a project with a small team
Prerequisite: You’ve created a directory with some code in it.

  1. Turn your source code directory into a bzr repository:
    ~/src/foo$ bzr init
  2. Add you source files:
    ~/src/foo$ bzr add
  3. Commit:
    ~/src/foo$ bzr ci
  4. Push my changes to a remote location* other team members can access:
    ~/src/foo$ bzr push --remember sftp://some/file/server

Done! My favorite part is that besides the --remember option, bzr just does what you expect without any flags or configuring. The --remember option simply tells bzr to use that location for future push commands (so you can drop all the typing after “push”).

For more information check out the excellent bazaar documentation on sharing code.

2. Getting the code for an open source project

Unfortunately most big bzr-hosted projects are on Launchpad which makes for a pretty boring demonstration:

~/src$ bzr branch lp:terminator # yawn

To make matters worse, non-Launchpad hosted projects are nearly as dull:

~/src$ bzr branch http://bzr.savannah.gnu.org/r/gnash/trunk

In each case bzr will create a new directory for you using the last part of the source path (terminator & trunk respectively). You can optionally give it a second argument to put the branch in a different location. The destination can even be a remote server!

~/src$ bzr branch http://source/branch sftp://destination/branch

Ok now I’m just showing off. I’ve never found a use for that feature. ;-) However, I do appreciate that a location is a location to bzr regardless of whether that location is the local filesystem or a remote server. It just works how you’d expect it.

Chapters 4-6 of Bazaar’s documentation give some excellent examples of various collaboration workflows.

Bonus Feature: Subversion mode!

So its not really Subversion mode, but bzr does support pulling repositories via the checkout command and updating your working copy from the remote repository via the update command just like Subversion. As you would expect, the commit now sends changes directly to the remote server.

While I’ve used this feature mainly to make transitioning to bzr easier for Subversion users, Bazaar’s documentation has some excellent techniques for making advanced workflows easier using checkouts.


* SSH Tips:

  • bzr+ssh is faster than plain old sftp but requires bzr to be installed on the server.
  • Setup ssh connection multiplexing using ControlMaster in ~/.ssh/config and leave an ssh session active to speed up bzr operations.

Why not Subversion + DVCS of Choice?

Tuesday, January 6th, 2009

A follow-up to my last post on DVCSes…

Gnomers have been discussing DVCSes a lot lately, and at least one seems to prefer bzr as the repository format and git as the protocol it speaks. If this sounds like madness to you, you’re not alone.

What I don’t understand is why more people don’t choose to keep Subversion as their repository and just use the $DVCS-svn of your choice?

Granted I’ve only used bzr-svn a bit, but it worked quite well and seems to only be getting better. I hear git-svn is quite good as well (but iirc hg lags behind the competition).

The benefits of this seem pretty nice:

  • Repository and Project management tools could get by with only first class Subversion support.
  • Directing inexperienced users to download code would be standardized.
  • Linux distributions wouldn’t have to ship 5 different VCSes (cvs, svn, git, bzr, hg), although the VCSes don’t take up much space.
  • Developers could use whichever tool they preferred, publish branches to any one of the zillions of free hosts for their DVCS of choice, and get on with their life.

Answering my own question…

The obvious counter argument is that in order to share code you either:

  • …force everyone who cares to use your DVCS.
  • …or lose some of the benefits of your chosen DVCS and share code via a SVN branch.

Lets face it, both options are a pretty big hassle for developers. Comprises always are.

For smaller single projects the overhead associated with going this route probably isn’t worth it. You’ll probably either end up losing 75% of what makes a DVCS handy or just use SVN.

Why is Gnome not considering this option though?

This option seems ideal for projects like Gnome. Individual modules will probably adopt a preferred DVCS, and thats fine. None of them are so different that a competent developer couldn’t yank some revisions from an unfamiliar DVCS.

The project as a whole (and individual modules) would continue to remain uniformly easily available through a single svn checkout.

At the very least isn’t this better (at least saner) than bolting git onto bzr’s repository format?

Audience Participation

I’m not a Gnome developer though. Just a curious user. However, as a fellow developer I am left wondering: why isn’t this a good option? Are $DVCS-svn connectors just not good enough? Are the comprises too great? Or the most likely: am I just missing some obvious showstopper?

Time to Learn Git?

Sunday, January 4th, 2009

Update: Doh! Sorry for flooding everyone’s feed readers with my epic post. Evidently WordPress ignored my “more” tag. I think I ran into this problem before…

Update 2: Retracted the meaningless Google Trends point. Thanks to commenters for pointing out how meaningless it was. I still feel like git has a much stronger web presence than bzr or hg, but its just another one of the many “gut feelings” in this post. :-)

The DVCS wars have been raging for a while now, and in case you haven’t been keeping score, git is winning. Admittedly I have no proof and don’t even know if proof is possible, but I have some good evidence of git’s march toward VCS dominance:
(more…)