utils.repo_info module

Tools to collect information about the repository

get_dirt_hash(repo=None)[source]

Get a SHA1 hash of all sources of dirt (modified tracked files). Explicitly, we collect all such files, hash their contents one by one, concatenate all hashes and hash them again (to avoid loading many large files in memory). If a file was deleted, its filenamed is hashed

Parameters

repo

Returns

hash summary of all the dirt elements

Return type

str

get_git_summary(repo=None)[source]

Generate a string summarizing the status of the repo The format is <commit hash>:<pip freeze hash>[:<dirt hash>]

Parameters

repo

Returns

Return type

str

get_pipfreeze_hash()[source]

Get a hash of the libraries installed in the current environment - generated by pip freeze

get_repo()[source]

Get a repository object for the working directory

Returns

the repository at the current working directory

Return type

git.Repo

get_repo_hash(repo=None)[source]

Collect the hash of the head of the repo

Parameters

repo (git.Repo, None) –

Returns

Return type

str

repo_is_dirty(repo=None)[source]

Get the status information of the repository.

Parameters

repo (git.Repo, optional) – The repository object to inspect, if none is given, the repo containing the working directory (if it exists) is used.

Returns

whether the repo is dirty

Return type

bool