def commit_changes(repo, commit_message):
"""Commits all changes (staged and untracked) in a single commit.
Args:
repo (git.objects.Repo): The git repository to commit changes to
commit_message (str): The commit message to use
Returns:
bool: True if a commit was made, False otherwise
"""
if not repo.is_dirty():
return False
repo.git.add(u=True)
actor = Actor(const.COMMIT_AUTHOR_NAME, email=const.COMMIT_AUTHOR_EMAIL)
commit = repo.index.commit(commit_message, author=actor, committer=actor)
io.info('commit message: "%s"' % (commit_message.split('\n')[0]),)
io.info('created commit: (id) %s' % (commit.name_rev,))
return True
评论列表
文章目录