From 60e0dc7b0dcf7da56c14d3b7b1158ff1b9bd31c5 Mon Sep 17 00:00:00 2001 From: morpheus65535 <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 4 Jun 2018 23:25:07 -0400 Subject: [PATCH] Reworking updating process --- check_update.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/check_update.py b/check_update.py index 00e447960..6e122dff8 100644 --- a/check_update.py +++ b/check_update.py @@ -26,14 +26,16 @@ def gitconfig(): def check_and_apply_update(): gitconfig() g = git.cmd.Git(current_working_directory) - result = g.pull('origin', branch) - if result.startswith('Already'): + result = g.diff('--shortstat', 'origin/' + branch) + if len(result) == 0: logging.info('No new version of Bazarr available.') - elif result.startswith('Updating') or result.startswith('Merge made'): - logging.info('Bazarr updated to latest version and need to be restarted.') - updated() else: - logging.info(result) + g.reset('--hard', 'HEAD') + g.checkout(branch) + g.reset('--hard','origin/' + branch) + g.pull('origin/' + branch) + logging.info('Bazarr updated to latest version and need to be restarted. ' + result) + updated() def updated(): conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)