Deploying to Heroku with Mercurial

Despite all the arguments for why git is better than x, Mercurial suits my purposes just fine. The only problem was I really wanted to start using Heroku for web app hosting, but their platform requires you to deploy via a git push.

It turns out there’s a nifty plugin for mercurial called Hg-Git which enables pushing to, and pulling from, a git repository. It’s beta software, but it seems to work just fine.

Once the hg-git is installed, follow the getting started guide for Heroku up until pushing to the remote server. You can then replace the git push instructions with

hg push git+ssh://[email protected]:<your-heroku-app-name>.git

To make life even easier, create an alias in the local hgrc:

[alias]
push-heroku  = push git+ssh://[email protected]:<your-heroku-app-name>.git

and push away with

hg push-heroku

The only problem with this systems is that the Heroku command line utility tries to determine the Heroku app name from the local git repository. Since there isn’t a git repository, you must specify --app <your-heroku-app-name> whenever using the Heroku tools.