This afternoon, I decided to convert my old code repositories from bzr to git, and move them from Launchpad to GitHub. I have converted Cassowary.net, PydgetRFID, Facade, as well as Uiml.net.
It turns out that converting a bzr repository with a single branch to git is quite easy. Here’s how I did it (after installing the latest versions of both bzr and git):
$ mkdir repo.git
$ cd repo.git
$ git init
$ bzr fast-export --plain ../repo.bzr | git fast-import
$ git reset --hard
repo.bzr is your old bzr repository here, while
repo.git is your newly created git repository. The fast-export/fast-import commands convert the repository’s history from bzr to git. To populate our directory with the bzr repository’s files, however, we also need to perform a hard reset. If you need to convert multiple bzr branches to git, have a look at this post.
I started experimenting with distributed version control systems (DVCS) while working on my MSc thesis (around 2005). I originally maintained Cassowary.net using darcs (a DVCS written in Haskell), and switched to bzr later. Back in the early days of Uiml.net, we used CVS, which was horrible at moving or renaming files, not to mention the inability to work offline and still commit your work.
I preferred darcs and bzr over git at the time because they were a lot easier to use. These days, git seems to have catched up to bzr in that regard. Back in 2006, I also did a few performance tests and found that bzr was a lot slower than git. Things seem to have improved somewhat, but git is still The King of Speed. Oh, and GitHub is great!
I just released version 0.1 of PydgetRFID, the Python interface to the Phidgets Inc. RFID kit I blogged about earlier. It’s free software (licensed under the GPL). It wraps libphidgets with ctypes to talk to the hardware.
The software is now more polished and additionally provides a D-Bus service that allows other applications (written in any language with D-Bus bindings) to use the hardware. Currently this means you can connect to the hardware from Python, Ruby, .NET, C, C++, Perl and Pascal!
This DBUS service allows to start and stop reading, and emits a signal whenever a different tag (including the nil value) is read. I modified the original PyGTK GUI to use this daemon for communicating with the hardware. Furthermore, I improved the HAL support so that plugging the device in and out is detected. Unfortunately, the daemon cannot yet handle this though. That’s for a next release
Here is the GUI (which you probably remember from the last post). Nil values are now colored red:
And this a screenshot showing the communication between the daemon and the GUI logged with dbus-monitor:
More information can be found at the PydgetRFID homepage.
I had some fun writing a Python wrapper around libphidgets for an RFID reader we had lying around here. To do so, I used ctypes (“apparantly”::http://ailab.ch/pipermail/libphidgets-discuss/2006-February/000442.html the Python bindings for libphidgets were broken). To check for a connected RFID reader, I interfaced with hal through dbus. Afterwards I created a simple GUI for the device with PyGTK.
Here is the result:
I experienced some weird permissions problems though. The device could only be opened with root privileges. Takis helped me step through libphidgets to see if there was a bug in it. In the end, we solved it by changing the
/etc/udev/rules.d/permissions.rules file (in my case it was called
40-permissions.rules). I’m not sure if there are any security problems with this though.
I changed these lines:
# USB devices (usbfs replacement)
# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device", GROUP="plugdev", MODE="0664"
I will probably put the code online when I have some spare time (and after I cleaned it up a bit).