mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 16:36:25 +00:00
bench update exclude app
This commit is contained in:
parent
63047730c5
commit
2799a12b2c
@ -162,13 +162,17 @@ def remove_app(app, bench_path='.'):
|
||||
restart_supervisor_processes(bench_path=bench_path)
|
||||
|
||||
|
||||
def pull_all_apps(bench_path='.', reset=False):
|
||||
def pull_all_apps(bench_path='.', reset=False, exclude=[]):
|
||||
'''Check all apps if there no local changes, pull'''
|
||||
rebase = '--rebase' if get_config(bench_path).get('rebase_on_pull') else ''
|
||||
|
||||
# chech for local changes
|
||||
if not reset:
|
||||
for app in get_apps(bench_path=bench_path):
|
||||
if app in exclude:
|
||||
print("Here")
|
||||
print("Skipping pull for app {}".format(app))
|
||||
continue
|
||||
app_dir = get_repo_dir(app, bench_path=bench_path)
|
||||
if os.path.exists(os.path.join(app_dir, '.git')):
|
||||
out = subprocess.check_output(["git", "status"], cwd=app_dir)
|
||||
|
@ -1,5 +1,6 @@
|
||||
import click
|
||||
import sys, os
|
||||
import ast
|
||||
from bench.config.common_site_config import get_config
|
||||
from bench.app import pull_all_apps, is_version_upgrade
|
||||
from bench.utils import (update_bench, validate_upgrade, pre_upgrade, post_upgrade, before_update,
|
||||
@ -8,6 +9,7 @@ from bench import patches
|
||||
|
||||
#TODO: Not DRY
|
||||
@click.command('update')
|
||||
@click.option('--exclude', default=[], required=False, help="Exclude pull for the apps")
|
||||
@click.option('--pull', is_flag=True, help="Pull changes in all the apps in bench")
|
||||
@click.option('--patch',is_flag=True, help="Run migrations for all sites in the bench")
|
||||
@click.option('--build',is_flag=True, help="Build JS and CSS artifacts for the bench")
|
||||
@ -18,12 +20,12 @@ from bench import patches
|
||||
@click.option('--no-backup',is_flag=True)
|
||||
@click.option('--force',is_flag=True)
|
||||
@click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull")
|
||||
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, force=False, reset=False):
|
||||
def update(exclude=[], pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, force=False, reset=False):
|
||||
"Update bench"
|
||||
|
||||
print("Exclude {}".format(exclude))
|
||||
if not (pull or patch or build or bench or requirements):
|
||||
pull, patch, build, bench, requirements = True, True, True, True, True
|
||||
|
||||
exclude = ast.literal_eval(exclude)
|
||||
if auto:
|
||||
sys.exit(1)
|
||||
|
||||
@ -57,7 +59,7 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
|
||||
|
||||
_update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, force=force, reset=reset)
|
||||
|
||||
def _update(pull=False, patch=False, build=False, update_bench=False, auto=False, restart_supervisor=False,
|
||||
def _update(exclude=[], pull=False, patch=False, build=False, update_bench=False, auto=False, restart_supervisor=False,
|
||||
requirements=False, no_backup=False, bench_path='.', force=False, reset=False):
|
||||
conf = get_config(bench_path=bench_path)
|
||||
version_upgrade = is_version_upgrade(bench_path=bench_path)
|
||||
@ -68,7 +70,7 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False
|
||||
before_update(bench_path=bench_path, requirements=requirements)
|
||||
|
||||
if pull:
|
||||
pull_all_apps(bench_path=bench_path, reset=reset)
|
||||
pull_all_apps(bench_path=bench_path, reset=reset, exclude=exclude)
|
||||
|
||||
if requirements:
|
||||
update_requirements(bench_path=bench_path)
|
||||
|
Loading…
Reference in New Issue
Block a user