def check_branch(): git = Git() if git.get_current_branch() not in BRANCHES_SUPPORTED_FOR_TAG: accepted_branches = ', '.join(BRANCHES_SUPPORTED_FOR_TAG) print("Tagging is only supported on {} " "you should not tag any other branch, exiting!".format(accepted_branches)) raise SystemExit(1)
def push(): git = Git() current_version = open('.VERSION', 'r').read() git.commit('Set version to {}'.format(current_version), '.VERSION') git.tag(current_version) git.push() git.push('origin', current_version)
def create_patch(old_version, new_version): git = Git() patch = git.create_patch(old_version, new_version) patch = filter_patch(patch) patch_file = os.path.join('{{cookiecutter.project_slug}}', '_CI', 'patches', f'{new_version}.patch') with open(patch_file, 'w') as ofile: ofile.write(patch) return patch_file
def push(current_version): git = Git() git.commit('Updated history file with changelog', 'HISTORY.rst') git.commit('Set version to {}'.format(current_version), '.VERSION') git.add_tag(current_version) git.push() git.push('origin', current_version) return current_version
def push(current_version): git = Git() git.commit('Add commit to history file', 'HISTORY.rst') git.commit('Set version to {}'.format(current_version), '.VERSION') git.add_tag(current_version) git.push() git.push('origin', current_version) return current_version
def commit_patch_and_push(segment, current_version, version_file_path): git = Git() new_version = bump(segment, version_file_path) print(f'Commiting version {new_version}') git.commit(f'Set version to {new_version}', version_file_path) print(f'Tagging version {new_version}') git.add_tag(new_version) print( f'Creating patch between version {current_version} and {new_version}') patch_file = create_patch(current_version, new_version) print(f'Adding file {patch_file} to git tracking') git.add(patch_file) print(f'Commiting {patch_file}') git.commit(f'Adding patch file for version "{new_version}"', patch_file) print('Pushing everything') git.push() print(f'Pushing tag {new_version}') git.push('origin', new_version) return new_version