Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_git_status() bug fix #1925

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def check_online():


def check_git_status():
# Suggest 'git pull' if YOLOv5 is out of date
# Recommend 'git pull' if code is out of date
print(colorstr('github: '), end='')
try:
if Path('.git').exists() and check_online():
Expand All @@ -66,13 +66,12 @@ def check_git_status():
n = int(subprocess.check_output(
'git rev-list $(git rev-parse --abbrev-ref HEAD)..origin/master --count', shell=True)) # commits behind
if n > 0:
s = f"⚠️ WARNING: code is out of date by {n} {'commits' if n > 1 else 'commmit'}. " \
f"Use 'git pull' to update or 'git clone {url}' to download latest."
print(f"⚠️ WARNING: code is out of date by {n} {'commits' if n > 1 else 'commmit'}. "
f"Use 'git pull' to update or 'git clone {url}' to download latest.")
else:
s = f'up to date with {url} ✅'
print(f'up to date with {url} ✅')
except Exception as e:
s = str(e)
print(s)
print(e)


def check_requirements(file='requirements.txt'):
Expand Down