2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

Merge pull request #487 from saurabh6790/prepare_ver_x_x

Prepare v{old_major}_x_x while releasing mjor version
This commit is contained in:
Saurabh 2017-12-20 15:13:57 +05:30 committed by GitHub
commit b3bc4a6ffb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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