Rebase of PR #177 - Add HG Basic Auth

This is a rebase of #177 which adds HG Basic Auth.