Fix version program to use git revision

The first step is already done by commit be2ac847b0e01b62a09393622097c6c2e494f3e3

What's still missing is support for extracting the most recently merged-in bzr revision from existing tags (see README.md), and moving some stuff in the version program into functions to make the code more legible.