Skip to content

Commit

Permalink
fix: validate branch before update
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabh6790 committed Jul 22, 2019
1 parent ac51286 commit d32d905
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions bench/app.py
Expand Up @@ -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)
5 changes: 3 additions & 2 deletions 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)
Expand Down Expand Up @@ -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()
Expand Down

1 comment on commit d32d905

@ckosiegbu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces a bug in bench update. Please see the following discussion:

https://discuss.erpnext.com/t/bench-update-error-no-such-file-or-directory-apps-erpnext/56932

Please sign in to comment.