def _find_git_info(self):
"""
Return information about the state of the Git repository tox is being
run from.
:return: dict with keys 'dirty' (bool), 'sha' (str), 'tag' (str or None)
:rtype: dict
"""
res = {}
logger.debug('Checking git status...')
repo = Repo(path=self._gitdir, search_parent_directories=False)
res['sha'] = repo.head.commit.hexsha
res['dirty'] = repo.is_dirty(untracked_files=True)
res['tag'] = None
for tag in repo.tags:
# each is a git.Tag object
if tag.commit.hexsha == res['sha']:
res['tag'] = tag.name
logger.debug('Git info: %s', res)
return res
评论列表
文章目录