mirror of
https://github.com/frappe/bench.git
synced 2025-02-10 14:48:35 +00:00
[fix] test_switch_to_branch - bring frappe back to develop
This commit is contained in:
parent
b0f571108d
commit
5a22215d62
13
bench/app.py
13
bench/app.py
@ -13,18 +13,15 @@ import subprocess
|
||||
logging.basicConfig(level="DEBUG")
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class InvalidBranchException(Exception): pass
|
||||
class InvalidRemoteException(Exception): pass
|
||||
|
||||
class MajorVersionUpgradeException(Exception):
|
||||
def __init__(self, message, upstream_version, local_version):
|
||||
super(MajorVersionUpgradeException, self).__init__(message)
|
||||
self.upstream_version = upstream_version
|
||||
self.local_version = local_version
|
||||
|
||||
class InvalidBranchException(Exception):
|
||||
pass
|
||||
|
||||
class InvalidRemoteException(Exception):
|
||||
pass
|
||||
|
||||
def get_apps(bench='.'):
|
||||
try:
|
||||
with open(os.path.join(bench, 'sites', 'apps.txt')) as f:
|
||||
@ -115,12 +112,12 @@ def is_version_upgrade(app='frappe', bench='.', branch=None):
|
||||
try:
|
||||
fetch_upstream(app, bench=bench)
|
||||
except CommandFailedError, e:
|
||||
raise InvalidRemoteException("No remote named Upstream for "+app)
|
||||
raise InvalidRemoteException("No remote named upstream for {0}".format(app))
|
||||
|
||||
upstream_version = get_upstream_version(app=app, branch=branch, bench=bench)
|
||||
|
||||
if not upstream_version:
|
||||
raise InvalidBranchException("Specified branch of app {} is not in upstream".format(app))
|
||||
raise InvalidBranchException("Specified branch of app {0} is not in upstream".format(app))
|
||||
|
||||
local_version = get_major_version(get_current_version(app, bench=bench))
|
||||
upstream_version = get_major_version(upstream_version)
|
||||
|
@ -20,8 +20,6 @@ class TestBenchInit(unittest.TestCase):
|
||||
if os.path.exists(bench_path):
|
||||
shutil.rmtree(bench_path, ignore_errors=True)
|
||||
|
||||
|
||||
|
||||
def test_init(self, bench_name="test-bench", **kwargs):
|
||||
self.init_bench(bench_name, **kwargs)
|
||||
|
||||
@ -128,6 +126,11 @@ class TestBenchInit(unittest.TestCase):
|
||||
out = subprocess.check_output(['git', 'status'], cwd=app_path)
|
||||
self.assertTrue("master" in out)
|
||||
|
||||
# bring it back to develop!
|
||||
bench.app.switch_branch(branch="develop", apps=["frappe"], bench=bench_path, check_upgrade=False)
|
||||
out = subprocess.check_output(['git', 'status'], cwd=app_path)
|
||||
self.assertTrue("develop" in out)
|
||||
|
||||
def init_bench(self, bench_name, **kwargs):
|
||||
self.benches.append(bench_name)
|
||||
bench.utils.init(bench_name, **kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user