Repository: facebookresearch/Mephisto

Issue:
Heroku deployment fails if the default git branch is not "master"
As we know, the default branch on git is being changed from `master` to `main` at various places (e.g. Github)

Heroku deployment has `git init` without a branch name 
https://github.com/facebookresearch/Mephisto/blob/588d5ca3eece7fd9edc394a5d42813b5cdd3dd83/mephisto/abstractions/architects/heroku_architect.py#L352

Which results in default/initial branch name resolved as per user's setting (in my case `main` not `master`) 
whereas `git push` has hardcoded `master`  branch

https://github.com/facebookresearch/Mephisto/blob/588d5ca3eece7fd9edc394a5d42813b5cdd3dd83/mephisto/abstractions/architects/heroku_architect.py#L422

So I get this error: 

```
  File "/Users/tg/work/projects/darma/Mephisto/mephisto/operations/operator.py", line 286, in launch_task_run_or_die
    task_url = live_run.architect.deploy()
  File "/Users/tg/work/projects/darma/Mephisto/mephisto/abstractions/architects/heroku_architect.py", line 492, in deploy
    return self.__setup_heroku_server()
  File "/Users/tg/work/projects/darma/Mephisto/mephisto/abstractions/architects/heroku_architect.py", line 422, in __setup_heroku_server
    sh.git(shlex.split(f"-C {heroku_server_directory_path} push -f heroku master"))
  File "/Users/tg/opt/miniconda3/envs/darma/lib/python3.9/site-packages/sh.py", line 1427, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/Users/tg/opt/miniconda3/envs/darma/lib/python3.9/site-packages/sh.py", line 774, in __init__
    self.wait()
  File "/Users/tg/opt/miniconda3/envs/darma/lib/python3.9/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/Users/tg/opt/miniconda3/envs/darma/lib/python3.9/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1:

  RAN: /usr/bin/git -C /Users/tg/work/projects/data/runs/NO_PROJECT/26/build/heroku_server_xxx_26/router push -f heroku master

  STDOUT:

  STDERR:
error: src refspec master does not match any
error: failed to push some refs to 'https://git.heroku.com/blahblah.git'
```



Discussion:

Resolving patch:
diff --git a/mephisto/abstractions/architects/heroku_architect.py b/mephisto/abstractions/architects/heroku_architect.py
--- a/mephisto/abstractions/architects/heroku_architect.py
+++ b/mephisto/abstractions/architects/heroku_architect.py
@@ -347,9 +347,9 @@ def __setup_heroku_server(self) -> str:
         server_dir = self.__get_build_directory()
 
         print("Heroku: Starting server...")
-
+        branch = "main"
         heroku_server_directory_path = os.path.join(server_dir, "router")
-        sh.git(shlex.split(f"-C {heroku_server_directory_path} init"))
+        sh.git(shlex.split(f"-C {heroku_server_directory_path} init -b {branch}"))
 
         heroku_app_name = self.__get_app_name()
 
@@ -419,7 +419,9 @@ def __setup_heroku_server(self) -> str:
         # commit and push to the heroku server
         sh.git(shlex.split(f"-C {heroku_server_directory_path} add -A"))
         sh.git(shlex.split(f'-C {heroku_server_directory_path} commit -m "app"'))
-        sh.git(shlex.split(f"-C {heroku_server_directory_path} push -f heroku master"))
+        sh.git(
+            shlex.split(f"-C {heroku_server_directory_path} push -f heroku {branch}")
+        )
 
         os.chdir(heroku_server_directory_path)
         subprocess.check_output(


Test patch: