20 February 2008

This is Why I Like Bazaar



Bazaar has been a great productivity booster for me lately. It enables me to work on several concurrent major refactoring tasks, and painlessly merge between them. You can imagine what it would be like to do several merges daily with SVN or (*shudder*) CVS.

The biggest new thing I'm currently working on is the Box2D integration. I'd estimate I'm about 40% done now, and the biggest obstacle has been (once again) having enough time to code, but I hope to have the main functionality + a simple demo working next weekend or next week.

16 February 2008

The Bazaar Is Open

I tested Bazaar for real development for a while, and it is really great. So, from now on all Opioid2D development will use Bazaar and the old Subversion repository is no longer maintained. The are two main branches in the public Bazaar repository

http://opioid-interactive.com/opioid2d/bzr/trunk

and

http://opioid-interactive.com/opioid2d/bzr/experimental

The trunk will mainly get bug fixes for now, and all new features are developed and published in the experimental branch. Once the features mature and undergo enough testing, they are merged into the trunk and a new alpha is released. I'm not going to rush the new releases until the new features are properly finished and the API stabilized, so I encourage you to get the experimental branch every once in a while if you need the latest and greatest features. Now that Opioid2D fully supports mingw, it should be pretty easy for anyone to compile their own extension. However, I can provide binary snapshots of the experimental branch if needed, so let me know if that is the case.

In order to download the trunk, for example, all you need to do is

bzr get http://opioid-interactive.com/opioid2d/bzr/trunk opioid2d

However, if you are going to use several different branches, I recommend you do the following:

bzr init-repo opioid2d
cd opioid2d
bzr get http://opioid-interactive.com/opioid2d/bzr/trunk
bzr get http://opioid-interactive.com/opioid2d/bzr/experimental


Creating your own local repository lets Bazaar share metadata between the different branches, so it's a bit more efficient.

Now if you want to make your own changes or fixes to the Opioid2D source, you should create your own branch. E.g.

cd opioid2d
bzr branch trunk my-bug-fix


The my-bug-fix is the name of the branch, which should be as informative as possible. I usually name bug fix branches beginning with fix-, so e.g. fix-sprite-edge-bug. At this point, you have your own complete copy of the source tree in the my-bug-fix folder, and you can freely make any changes you need. After you are done (and periodically while you are working), you run bzr commit to record your change history into your local branch. Finally, you run

bzr send -o my-bug-fix.patch

Which creates a patch file you can send to me to be included in the main trunk. Alternatively, you can publish your branch e.g. via HTTP and just send me the URL.

06 February 2008

Opioid2D Version Control

I've been reading a lot about distributed version control systems lately, and have come to the conclusion that the development of Opioid2D would benefit from lot of the features available in them. I code on several PCs and e.g. my laptop is often cut off from the net when I travel. Distributed version control like Bazaar would make it easy to retain version history while offline and then merge the revisions to the online repository when regaining net connectivity. I'm also going to be doing some major refactoring of the C++ internals, and I think the distributed model of "branch per feature/bugfix" would make things a lot easier.

The one thing that worries me is that Subversion is something that is familiar to almost all developers, so it is easy for anyone interested in O2D to grab the SVN trunk. Distributed version control systems, however, don't seem to be as widely used or even known. I looked at several different solutions, and Bazaar is currently my top choice because it seemed to have the lowest barrier to entry with decent documentation and support for Linux, Windows and MacOSX. Mercurial was a close contender, especially since TortoiseHg seems more mature than TortoiseBzr at this point, but after giving them both a try, I slightly prefer using Bazaar (and its quick-start guide was a lot more comprehensive).

Another good thing about Bazaar compared to SVN is that I could publish the repository via a standard web hosting service and thus put it on the same server that contains the Opioid2D web pages. I'm currently renting a virtual server to run svnd in, and it hasn't been very reliable (nor cheap enough to justify the mediocre up-times).