handling update w/o connection

This commit is contained in:
langolierz
2018-10-15 22:40:01 +00:00
parent 94c7d232c3
commit 24f2f17a60

View File

@@ -7,7 +7,7 @@ from pythonosc import osc_message_builder
from pythonosc import dispatcher from pythonosc import dispatcher
from pythonosc import osc_server from pythonosc import osc_server
from pythonosc import dispatcher from pythonosc import dispatcher
from git import Repo import git
import threading import threading
import argparse import argparse
from video_centre.capture import Capture from video_centre.capture import Capture
@@ -515,12 +515,25 @@ class Actions(object):
self.serial_port_process = None self.serial_port_process = None
def try_pull_code_and_reset(self): def try_pull_code_and_reset(self):
recur_repo = Repo("~/r_e_c_u_r") #self.message_handler.set_message('INFO', 'checkin fo updates pls wait')
conjur_repo = Repo("~/openFrameworks/apps/myApps/c_o_n_j_u_r") recur_repo = git.Repo("~/r_e_c_u_r")
conjur_repo = git.Repo("~/openFrameworks/apps/myApps/c_o_n_j_u_r")
current_recur_hash = recur_repo.head.object.hexsha current_recur_hash = recur_repo.head.object.hexsha
current_conjur_hash = conjur_repo.head.object.hexsha current_conjur_hash = conjur_repo.head.object.hexsha
recur_repo.remotes.origin.pull() try:
conjur_repo.remotes.origin.pull() recur_repo.remotes.origin.pull()
conjur_repo.remotes.origin.pull()
except git.exc.GitCommandError as e:
if 'unable to access' in str(e):
self.message_handler.set_message('INFO', 'not connected to network')
else:
if hasattr(e, 'message'):
error_info = e.message
else:
error_info = e
self.message_handler.set_message('ERROR',error_info)
return
new_recur_hash = recur_repo.head.object.hexsha new_recur_hash = recur_repo.head.object.hexsha
new_conjur_hash = conjur_repo.head.object.hexsha new_conjur_hash = conjur_repo.head.object.hexsha
if current_recur_hash != new_recur_hash or current_conjur_hash != new_conjur_hash : if current_recur_hash != new_recur_hash or current_conjur_hash != new_conjur_hash :