2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-13 16:56:33 +00:00

fix: only get the specific branch for version check

This commit is contained in:
Richard Case 2021-03-10 19:58:55 +00:00 committed by casesolved-co-uk
parent 895c403278
commit 0ff8dddef9

View File

@ -345,13 +345,14 @@ def get_develop_version(app, bench_path='.'):
def get_upstream_version(app, branch=None, bench_path='.'):
repo_dir = get_repo_dir(app, bench_path=bench_path)
if not branch:
branch = get_current_branch(app, bench_path=bench_path)
try:
subprocess.call('git fetch --depth=1 --no-tags upstream', shell=True, cwd=repo_dir)
subprocess.call('git fetch --depth=1 --no-tags upstream {branch}'.format(branch=branch), shell=True, cwd=repo_dir)
except CommandFailedError:
raise InvalidRemoteException('Failed to fetch from remote named upstream for {0}'.format(app))
if not branch:
branch = get_current_branch(app, bench_path=bench_path)
try:
contents = subprocess.check_output('git show upstream/{branch}:{app}/__init__.py'.format(branch=branch, app=app),
shell=True, cwd=repo_dir, stderr=subprocess.STDOUT)