ci_diff_helper.git_tools module

Helpers for interacting with git.

ci_diff_helper.git_tools.commit_subject(revision='HEAD')[source]

Gets the subject of a git commit.

Parameters:revision (Optional [ str ]) – A git revision, any of a branch name, tag, a commit SHA or a special reference.
Returns:The commit subject.
Return type:str
ci_diff_helper.git_tools.get_checked_in_files()[source]

Gets a list of files in the current git repository.

Effectively runs:

$ git ls-files ${GIT_ROOT}

and then finds the absolute path for each file returned.

Returns:List of all filenames checked into.
Return type:list
ci_diff_helper.git_tools.git_root()[source]

Return the root directory of the current git checkout.

Returns:Filesystem path to git checkout root.
Return type:str
ci_diff_helper.git_tools.merge_commit(revision='HEAD')[source]

Checks if a git revision is a merge commit.

Parameters:revision (Optional [ str ]) – A git revision, any of a branch name, tag, a commit SHA or a special reference.
Returns:Flag indicating if the given revision.
Return type:bool
Raises:NotImplementedError – if the number of parents is not 1 or 2.