git status check - linux and darwin

This commit is contained in:
Glenn Jocher 2020-05-09 22:35:44 -07:00
parent 965155ee60
commit ae2bc020eb
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,4 @@
import argparse import argparse
from sys import platform
from models import * # set ONNX_EXPORT in models.py from models import * # set ONNX_EXPORT in models.py
from utils.datasets import * from utils.datasets import *

View File

@ -5,6 +5,7 @@ import random
import shutil import shutil
import subprocess import subprocess
from pathlib import Path from pathlib import Path
from sys import platform
import cv2 import cv2
import matplotlib import matplotlib
@ -33,10 +34,11 @@ def init_seeds(seed=0):
def check_git_status(): def check_git_status():
# Suggest 'git pull' if repo is out of date if platform in ['linux', 'darwin']:
s = subprocess.check_output('if [ -d .git ]; then git fetch && git status -uno; fi', shell=True).decode('utf-8') # Suggest 'git pull' if repo is out of date
if 'Your branch is behind' in s: s = subprocess.check_output('if [ -d .git ]; then git fetch && git status -uno; fi', shell=True).decode('utf-8')
print(s[s.find('Your branch is behind'):s.find('\n\n')] + '\n') if 'Your branch is behind' in s:
print(s[s.find('Your branch is behind'):s.find('\n\n')] + '\n')
def load_classes(path): def load_classes(path):