Repository

class neophile.repository.Repository(path: Path)

Bases: object

Wrapper around a Git repository to add some convenience functions.

Parameters

path (str) – 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: Path, url: str) Repository

Clone a repository or update an existing repository.

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

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

Returns

repo – Newly-created repository object.

Return type

Repository

restore_branch() None

Switch back to the branch before switch_branch was called.

Also deletes the neophile branch to clean up.

switch_branch() None

Switch to the neophile working branch.

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() None

Update an existing checkout to its current upstream.