API reference

Main Class

class heroku_git_fs.HerokuGitFS(remote_url, directory, branch, keep_history=False)[source]
__init__(remote_url, directory, branch, keep_history=False)[source]

Initiate a new gitFS folder.

Parameters:
  • branch (str) – The branch to push and commit changes to
  • remote_url (str) – The remote URL for the branch
  • directory (str) – The directory to clone to
  • keep_history (bool) – If set to True, then the git repository will not be orphaned on each new commit.
remote_url = None

The remote URL of the repository

directory = None

The directory used by HerokuGitFS

keep_history = None

If this is True, the repository will not be orphaned.

branch = None

The branch to use and push to.

repo = None

:any:git.Repo object to do operations on.

commit(message='No message given.', username=None, email='dummy@email.com')[source]

Create a new commit. If the keep_history attribute is set to False, the branch will be orphaned.

Parameters:
  • message (str) – The commit message.
  • username (str) – The name to commit with, defaults to the current user.
  • email (str) – The email to commit with, defaults to a dummy email.
push(remote_url=None)[source]

Push the commit to the remote.

Parameters:remote_url (str) – The remote URL to push for. If left empty, the init URL is used
Raises:Exception – Pushing the code to the remote failed.
update(message='No message given.', username=None, email='dummy@email.com')[source]

Wrapper around commit and push.

Parameters:
  • message (str) – Message to commit with, defaults to No message given.
  • username (str) – The name to commit with, defaults to the current user.
  • email (str) – The email to commit with, defaults to a dummy email.
close()[source]

Nulls the repo and branch attributes and removes the git directory. Also called by __exit__, although you’ll need to set the object to None manually if you call close() yourself.

It should be obvious that after this call, you should no longer use commit() or push() .

Raises:Exception – Any exceptions raised by removing the directory.