From 43ab34e28a79feed2b6442080824ccf8d3b6dd20 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 27 Sep 2017 16:57:05 +0530 Subject: [PATCH] [fix] provision to push old version branch before major release --- bench/release.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bench/release.py b/bench/release.py index c58a446a..af2bcd53 100755 --- a/bench/release.py +++ b/bench/release.py @@ -57,6 +57,7 @@ def bump(bench_path, app, bump_type, from_branch, to_branch, remote, owner, repo assert bump_type in ['minor', 'major', 'patch', 'stable', 'prerelease'] repo_path = os.path.join(bench_path, 'apps', app) + push_branch_for_old_major_version(bench_path, bump_type, app, repo_path, from_branch, to_branch, remote, owner) update_branches_and_check_for_changelog(repo_path, from_branch, to_branch, remote=remote) message = get_release_message(repo_path, from_branch=from_branch, to_branch=to_branch, remote=remote) @@ -299,3 +300,24 @@ def create_github_release(repo_path, tag_name, message, remote='upstream', owner raise return r +def push_branch_for_old_major_version(bench_path, bump_type, app, repo_path, from_branch, to_branch, remote, owner): + if bump_type != 'major': + return + + current_version = get_current_version(repo_path) + old_major_version_branch = "v{major}_x_x".format(major=current_version.split('.')[0]) + + click.confirm('Do you want to push {branch}?'.format(branch=old_major_version_branch), abort=True) + + update_branch(repo_path, to_branch, remote=remote) + + g = git.Repo(repo_path).git + g.checkout(b=old_major_version_branch) + + args = [ + '{old_major_version_branch}:{old_major_version_branch}'.format(old_major_version_branch=old_major_version_branch), + ] + + print("Pushing {old_major_version_branch} ".format(old_major_version_branch=old_major_version_branch)) + print(g.push(remote, *args)) +