Search code examples
macosgitmercurialherokuhg-git

hg-git deploy to heroku from Lion


I have this application on my Lion machine that is in a mercurial repository so I'm using hg-git to deploy it to heroku.

~/.hgrc

[extensions]
hgext.bookmarks =
hggit =

.../project/.hg/hgrc

[paths]
default = https://validhgrepo.com

[alias]
push-heroku  = push git+ssh://git@heroku.com:appname.git

Then when I run hg push-heroku it should deploy, but instead I get:

caseys-MacBook-Air:project casey$ hg push-heroku
pushing to git+ssh://git@heroku.com:appname.git/
creating and sending data
["git-receive-pack 'appname.git/'"]

 !  Invalid path.
 !  Syntax is: git@heroku.com:<app>.git where <app> is your app's name.

abort: git remote error: The remote server unexpectedly closed the connection.

This doesn't make any sense. I feel like the error message is misleading because that repository DOES exist.

Also this works perfect on my ubuntu machine with a similar setup.


Solution

  • Turns out this was related to this issue. I hadn't noticed the extra slash before. I applied a patch similar to this guy and it worked for me (on latest hg, hg-git and osx).

    Full details of how to install the patch:

    1. first uninstall it

      sudo easy_install -m 'hg-git'
      
    2. then delete the hg-git egg file in ~/Library/Python/2.7/site-packages

    3. install as directory

       sudo easy_install -Z 'hg-git'
      
    4. open ~/Library/Python/2.7/site-packages/hg_git..../hggit/git_handler.py

    5. apply patch by hand (mine was more like line 1118)

      --- git_handler.py  Thu Jul 28 22:05:45 2011
      +++ patched.git_handler.py  Thu Jul 28 22:11:44 2011
      @@ -1066,6 +1066,8 @@
      
                      port = None
                      host, path = hostpath.split(hostpath_seper, 1)
      +               if (host.find('heroku') > 0):
      +                    path = path.rstrip('/')
                      if hostpath_seper == '/':
                      transportpath = '/' + path
                      else: