From d32d905567d40c99387cf7dc8cbbcaa57e631f65 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 22 Jul 2019 16:10:28 +0530 Subject: [PATCH] fix: validate branch before update --- bench/app.py | 10 ++++++++++ bench/commands/update.py | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bench/app.py b/bench/app.py index 896affa2..8b6c25e2 100755 --- a/bench/app.py +++ b/bench/app.py @@ -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) \ No newline at end of file diff --git a/bench/commands/update.py b/bench/commands/update.py index e91eef1b..af32b424 100755 --- a/bench/commands/update.py +++ b/bench/commands/update.py @@ -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()