mercurial overhaul from http://jamie-wong.com/2012/07/11/my-mercurial-setup-and-workflow-at-khan-academy/