def getcommits(self):
"""Return meta data about exitsting commits.
Returns:
A list containing dictionaries with commit meta data
"""
commits = []
if len(self.repo.listall_reference_objects()) > 0:
for commit in self.repo.walk(self.repo.head.target, GIT_SORT_REVERSE):
commits.append({
'id': str(commit.oid),
'message': str(commit.message),
'commit_date': datetime.fromtimestamp(
commit.commit_time).strftime('%Y-%m-%dT%H:%M:%SZ'),
'author_name': commit.author.name,
'author_email': commit.author.email,
'parents': [c.hex for c in commit.parents],
}
)
return commits
评论列表
文章目录