def __init__(self, config=None):
self.repo = Repo()
self.commit_format = (config or {}).get('commit_format', 'Release {version}')
self.tag_format = (config or {}).get('tag_format', '{version}')
if self.repo.head.ref != self.repo.heads.master:
# TODO: Support releasing from stable/hotfix branches
raise Exception('You need to be on the `master` branch in order to do a release.')
if self.repo.is_dirty():
raise Exception('Git repository has unstaged changes.')
if len(self.repo.untracked_files) > 0:
raise Exception('Git repository has untracked files.')
if self.has_origin():
self.repo.remotes.origin.fetch()
if self.repo.remotes.origin.refs.master.commit != self.repo.head.ref.commit:
raise Exception('Master has unsynced changes.')
评论列表
文章目录