Add comments, fix code style, fix tag bug

Added some more comments to document the code.
Updated the copyright line on the top.
Fixed code style to be consistent in this file.
Fixed a bug where when reading the highest bzr revision merged and tagged, the
wrong refs might be considered (for refs in the .git/refs/tags/ directory, it
was not checked whether the tag name begins with "bzr").
Add TravisCI config file