Consolidated get_revision() and coverage fixes

Here is the pull request for the unstable branch. As I said, although this fails on CI, it works locally on my laptop with Ubuntu and OSX. I also tried to put in a few sleep() here and there to allow travis to catch up, but no dice. 

In any case, let me know if this works in your local setup.