mirror of
https://github.com/frappe/bench.git
synced 2025-01-26 08:08:23 +00:00
fix: check for valid branch in resolve
This commit is contained in:
parent
17888a5ce5
commit
79765e6b25
@ -24,6 +24,7 @@ from bench.utils import (
|
|||||||
get_available_folder_name,
|
get_available_folder_name,
|
||||||
is_bench_directory,
|
is_bench_directory,
|
||||||
is_git_url,
|
is_git_url,
|
||||||
|
is_valid_frappe_branch,
|
||||||
log,
|
log,
|
||||||
run_frappe_cmd,
|
run_frappe_cmd,
|
||||||
)
|
)
|
||||||
@ -244,6 +245,7 @@ def make_resolution_plan(app: App, bench: "Bench"):
|
|||||||
|
|
||||||
for app_name in app._get_dependencies():
|
for app_name in app._get_dependencies():
|
||||||
dep_app = App(app_name, bench=bench)
|
dep_app = App(app_name, bench=bench)
|
||||||
|
is_valid_frappe_branch(dep_app.url, dep_app.branch)
|
||||||
if dep_app.repo in resolution:
|
if dep_app.repo in resolution:
|
||||||
click.secho(f"{dep_app.repo} is already resolved skipping", fg="yellow")
|
click.secho(f"{dep_app.repo} is already resolved skipping", fg="yellow")
|
||||||
continue
|
continue
|
||||||
|
@ -58,7 +58,7 @@ def is_valid_frappe_branch(frappe_path, frappe_branch):
|
|||||||
raise InvalidRemoteException
|
raise InvalidRemoteException
|
||||||
git_api = f"https://api.github.com/repos/{owner}/{repo}/branches"
|
git_api = f"https://api.github.com/repos/{owner}/{repo}/branches"
|
||||||
res = requests.get(git_api).json()
|
res = requests.get(git_api).json()
|
||||||
if "message" in res or frappe_branch not in [x["name"] for x in res]:
|
if "message" in res or (frappe_branch and frappe_branch not in [x["name"] for x in res]):
|
||||||
raise InvalidRemoteException
|
raise InvalidRemoteException
|
||||||
|
|
||||||
|
|
||||||
@ -76,9 +76,7 @@ def log(message, level=0, no_log=False):
|
|||||||
color, prefix = levels.get(level, levels[0])
|
color, prefix = levels.get(level, levels[0])
|
||||||
|
|
||||||
if bench.cli.from_command_line and bench.cli.dynamic_feed:
|
if bench.cli.from_command_line and bench.cli.dynamic_feed:
|
||||||
bench.LOG_BUFFER.append(
|
bench.LOG_BUFFER.append({"prefix": prefix, "message": message, "color": color})
|
||||||
{"prefix": prefix, "message": message, "color": color}
|
|
||||||
)
|
|
||||||
|
|
||||||
if no_log:
|
if no_log:
|
||||||
click.secho(message, fg=color)
|
click.secho(message, fg=color)
|
||||||
@ -196,9 +194,7 @@ def get_git_version() -> float:
|
|||||||
def get_cmd_output(cmd, cwd=".", _raise=True):
|
def get_cmd_output(cmd, cwd=".", _raise=True):
|
||||||
output = ""
|
output = ""
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(
|
output = subprocess.check_output(cmd, cwd=cwd, shell=True, stderr=subprocess.PIPE, encoding="utf-8").strip()
|
||||||
cmd, cwd=cwd, shell=True, stderr=subprocess.PIPE, encoding="utf-8"
|
|
||||||
).strip()
|
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
if e.output:
|
if e.output:
|
||||||
output = e.output
|
output = e.output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user