WIP: adding hg support

This is not actually a pull request yet, but @ahmadia said it would be useful to show some of my work so far if folks want to comment. I'll keep working in the meantime.

Unfortunately, it's kind of hard to see what I've changed so far from the copy of GitSourceCache -> HgSourceCache. But it should be pretty obvious what's still git and what's hg.
I'm assuming this is just copy-pasta from Git.