Add support for hg
Merge pull request #599 from cdlib/v3

Add support for hg.