Repository#

class neophile.repository.Repository(path)#

Bases: object

Wrapper around a Git repository to add some convenience functions.

Parameters:

path (Path) – Root path of the Git repository.

Methods Summary

clone_or_update(path, url)

Clone a repository or update an existing repository.

restore_branch()

Switch back to the branch before switch_branch was called.

switch_branch()

Switch to the neophile working branch.

update()

Update an existing checkout to its current upstream.

Methods Documentation

classmethod clone_or_update(path, url)#

Clone a repository or update an existing repository.

Parameters:
  • path (Path) – Path to where the clone should be kept (and may already exist).

  • url (str) – URL of the remote repository.

Returns:

Newly-created repository object.

Return type:

Repository

restore_branch()#

Switch back to the branch before switch_branch was called.

Also deletes the neophile branch to clean up.

Return type:

None

switch_branch()#

Switch to the neophile working branch.

Return type:

None

Notes

Currently this unconditionally creates the branch and fails if it already exists. Eventually this will be smarter about updating the neophile branch as appropriate.

update()#

Update an existing checkout to its current upstream.

Return type:

None