Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link a folder with an existing Heroku app with mercurial

I have an existing Django app on Bitbucket and I'm able to deploy to Heroku whith hg-git. Whenever i want to run some heroku command inside my app folder i get the following errors:

$ heroku ps
 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app <app name>
$ heroku logs
 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app <app name>
etc.

Current workaround is to specify the app name: heroku ps --app <app name> but i'm looking for a way to link my repository name to the remote Heroku app name like how it's done using git.

I'm not in a position to move my app to github for now.

like image 333
Maxime R. Avatar asked Dec 28 '22 03:12

Maxime R.


2 Answers

I'd suggest trying Hg-Git's "intree" configuration option. Set that by adding the following to your hgrc:

[git]
intree = True

With that set, the Git repository used internally by Hg-Git will be stored as a ".git" directory within the working copy, rather than nested within the ".hg" directory.

Heroku will then see this repository's config. Add a remote as suggested in the other answer (quoted below), and you should be all set.

git remote add heroku [email protected]:<app-name>.git

For now, the best documentation of Hg-Git configuration options that I've found is the README displayed on the project's Bitbucket page: https://bitbucket.org/durin42/hg-git

like image 163
davidmc24 Avatar answered Jan 13 '23 13:01

davidmc24


Considering heroku is looking at the .git/config file to get the app name, just do the following inside your local repository:

git init
git remote add heroku [email protected]:<app-name>.git

In order not to mess your repository, you'll also add the following lines to .hgignore:

#Git setup
.git/**

Now, usual heroku commands no more ask for the default app name.

like image 42
Maxime R. Avatar answered Jan 13 '23 13:01

Maxime R.