Sunday, January 11, 2009

Bazaar API

I've been poking around in the Bazaar API to learn how I could create repositories from my TomsProjectUtility program. The easiest way to do this would be to simply run the bzr utility in a sub-process, but what fun would that be? Since my program and Bazaar are both written in Python, I felt it would be more interesting to use the Bazaar API directly. Running a Bazaar command is easy. Each command is a class with a run() method with takes the same arguments that you pass on the command line.

Writing a unit test for my application code proved more challenging. My first attempt used the equivalent of a "bzr check" command but it does not provide enough detail for a complete test. I had to make sure that my application creates a Bazaar shared repository as well. I had to dig a little deeper in into how "bzr check" works to figure out how to test for the shared repository but it was worth it. I now have everything that my utility needs to create the Bazaar repository automatically.

Unfortunately, I ran out of time today so actual implementation will have to wait a little longer.

No comments:

Post a Comment