nicetoolbox.utils.git_utils¶
Helper functions for git integration of the code
Classes
Customize the Repo class from gitpython for easier access/use. |
- class nicetoolbox.utils.git_utils.CustomRepo(repo_path)[source]¶
Customize the Repo class from gitpython for easier access/use.
This class extends the base class Repo from gitpython and provides additional methods for easier access and use of a git repository.
- Parameters:
repo_path (str) – The path to the git repository.
- Raises:
RuntimeError – If the repo_path is not a valid directory or a git repository.
- None¶
See also
Documentation of the base class Repo: https://gitpython.readthedocs.io/en/stable/index.html
Create a new Repo instance
- Parameters:
path –
the path to either the root git directory or the bare git repo:
repo = Repo("/Users/mtrier/Development/git-python") repo = Repo("/Users/mtrier/Development/git-python.git") repo = Repo("~/Development/git-python.git") repo = Repo("$REPOSITORIES/Development/git-python.git") repo = Repo("C:\Users\mtrier\Development\git-python\.git")
In Cygwin, path may be a ‘cygdrive/…’ prefixed path.
If it evaluates to false,
GIT_DIRis used, and if this also evals to false, the current-directory is used.
odbt – Object DataBase type - a type which is constructed by providing the directory containing the database objects, i.e. .git/objects. It will be used to access all object data
search_parent_directories –
if True, all parent directories will be searched for a valid repo as well.
Please note that this was the default behaviour in older versions of GitPython, which is considered a bug though.
- Raises:
InvalidGitRepositoryError –
NoSuchPathError –
- Returns:
git.Repo