2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-24 23:48:24 +00:00

[fix] provision to push old version branch before major release

This commit is contained in:
Saurabh 2017-09-27 16:57:05 +05:30
parent c97be6ab1f
commit 43ab34e28a

View File

@ -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))