I’ve taken the plunge and am in the middle of switching from Subversion to Mercurial for revision control. Subversion has served me relatively faithfully for many years (I’ve even championed/led the adoption of subversion at two companies I’ve worked for in the past) but some of the warts and shortcomings were beginning to annoy me (. directories everywhere for example). Dave Dribin’s series of posts about the Mercurial DVCS software piqued my interest and I was soon switching repositories to hg.
One feature that added recently that hg lacked was the ability to store repository passwords in the Mac OS X keychain. In fact mercurial lacks the ability to store a repository password anywhere other than in the url used to access the repository (i.e. http://user:password@example.com/path). I think this is a bit of security flaw. The password is stored as plain text within the repository config file (’.hg/hgrc’) file.
Fortunately Mercurial provides a simple interface for extension modules. After a little bit of hacking I was able to write an hg extension that stores and retrieves the password from the keychain. I’ve put the code online for anyone to use. hgkeychain:
And yes the source code is currently hosted in a Subversion repository :-) I did mention I’m in the middle of transitioning to Mercurial didn’t I?
Update
I’ve update the project for Mercurial 1.1 – it should now work on 1.1 and also 1.0 (and lower). I’ve also decided to move the code to bitbucket instead: https://www.bitbucket.org/schwa/hgkeychain/