atudomain.git.Git

class atudomain.git.Git.Git(directory: str, binary_path='')

Represents git repository. Can be used to extract Commits and examine branches. It can also be used to conveniently run git commands and get their output.

Parameters
  • directory (str) – Path to git repository or bare repository.

  • binary_path (str) – Path to directory with git binary.

get_branches(include=None, exclude=None)List[str]

Extracts branch names from ‘git branch –all’ command and appends them to a list. Skips redundant information such as current branch pointer (‘*’) or relations (‘->’).

Parameters
  • include (str) – Regex (re module) to include branch names in list. None means all.

  • exclude (str) – Regex (re module) to exclude branch names from list.

Returns

List of branch names.

Return type

List[str]

get_commits(revision_range='')List[atudomain.git.Commit.Commit]

Extracts commits from git ‘log –pretty=raw’ command, creates Commit objects from them and appends them to a list.

Parameters

revision_range (str) – Any revision range that could be used with git log command.

Returns

List of Commit objects extracted.

Return type

List[Commit]