From 6c5419716d87af1a23d4ac121a8dd177cee793bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Tue, 21 Nov 2017 16:09:33 -0500 Subject: [PATCH] Better error management --- check_update.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/check_update.py b/check_update.py index def41fe11..5629623bf 100644 --- a/check_update.py +++ b/check_update.py @@ -28,7 +28,20 @@ def check_and_apply_update(repo=local_repo, remote_name='origin'): repo.head.set_target(remote_id) result = 'Bazarr updated to latest version and restarting.' os.execlp('python', 'python', os.path.join(os.path.dirname(__file__), 'bazarr.py')) + elif merge_result & pygit2.GIT_MERGE_ANALYSIS_NORMAL: + repo.merge(remote_id) + print repo.index.conflicts + + assert repo.index.conflicts is None, 'Conflicts, ahhhh!' + user = repo.default_signature + tree = repo.index.write_tree() + commit = repo.create_commit('HEAD', + user, + user, + 'Merge!', + tree, + [repo.head.target, remote_master_id]) + repo.state_cleanup() else: raise AssertionError('Unknown merge analysis result') - return result