glenn-jocher
commited on
Commit
•
051e9e8
1
Parent(s):
509dd51
check_git_status() bug fix (#1925)
Browse files- utils/general.py +5 -6
utils/general.py
CHANGED
@@ -57,7 +57,7 @@ def check_online():
|
|
57 |
|
58 |
|
59 |
def check_git_status():
|
60 |
-
#
|
61 |
print(colorstr('github: '), end='')
|
62 |
try:
|
63 |
if Path('.git').exists() and check_online():
|
@@ -66,13 +66,12 @@ def check_git_status():
|
|
66 |
n = int(subprocess.check_output(
|
67 |
'git rev-list $(git rev-parse --abbrev-ref HEAD)..origin/master --count', shell=True)) # commits behind
|
68 |
if n > 0:
|
69 |
-
|
70 |
-
|
71 |
else:
|
72 |
-
|
73 |
except Exception as e:
|
74 |
-
|
75 |
-
print(s)
|
76 |
|
77 |
|
78 |
def check_requirements(file='requirements.txt'):
|
|
|
57 |
|
58 |
|
59 |
def check_git_status():
|
60 |
+
# Recommend 'git pull' if code is out of date
|
61 |
print(colorstr('github: '), end='')
|
62 |
try:
|
63 |
if Path('.git').exists() and check_online():
|
|
|
66 |
n = int(subprocess.check_output(
|
67 |
'git rev-list $(git rev-parse --abbrev-ref HEAD)..origin/master --count', shell=True)) # commits behind
|
68 |
if n > 0:
|
69 |
+
print(f"⚠️ WARNING: code is out of date by {n} {'commits' if n > 1 else 'commmit'}. "
|
70 |
+
f"Use 'git pull' to update or 'git clone {url}' to download latest.")
|
71 |
else:
|
72 |
+
print(f'up to date with {url} ✅')
|
73 |
except Exception as e:
|
74 |
+
print(e)
|
|
|
75 |
|
76 |
|
77 |
def check_requirements(file='requirements.txt'):
|