2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

fix: validate branch before update

This commit is contained in:
Saurabh 2019-07-22 16:10:28 +05:30
parent ac51286f3c
commit d32d905567
2 changed files with 13 additions and 2 deletions

View File

@ -421,3 +421,13 @@ def get_apps_json(path):
else:
with open(path) as f:
return json.load(f)
def validate_branch():
for app in ['frappe', 'erpnext']:
branch = get_current_branch(app)
if branch == "master":
print(''' master branch is renamed to version-11 and develop to version-12. Please switch to new branches to get future updates.
To switch to version 11, run the following commands: bench switch-to-branch version-11''')
sys.exit(1)

View File

@ -1,7 +1,7 @@
import click
import sys, os
from bench.config.common_site_config import get_config, update_config
from bench.app import pull_all_apps, is_version_upgrade
from bench.app import pull_all_apps, is_version_upgrade, validate_branch
from bench.utils import (update_bench, validate_upgrade, pre_upgrade, post_upgrade, before_update,
update_requirements, update_node_packages, backup_all_sites, patch_sites, build_assets,
restart_supervisor_processes, restart_systemd_processes)
@ -48,8 +48,9 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
print('Release bench, cannot update')
sys.exit(1)
version_upgrade = is_version_upgrade()
validate_branch()
version_upgrade = is_version_upgrade()
if version_upgrade[0]:
print()
print()