From 0c3a6b44f807fafa9205f5c7100add8194380b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 15 Apr 2019 06:59:28 +0200 Subject: [PATCH] tools/pr.py: add --rebase=true to pull command and abort if there are conflicts --- tools/pr.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/pr.py b/tools/pr.py index c8a96a56d..241b0800e 100644 --- a/tools/pr.py +++ b/tools/pr.py @@ -13,7 +13,15 @@ if response.status_code == 200: sha = j['head']['sha'] subprocess.call('git checkout -b {}-{} master'.format(login, branch).split()) - subprocess.call('git pull https://github.com/{}/cppcheck.git {}'.format(login, branch).split()) + p = subprocess.call('git pull --rebase=true https://github.com/{}/cppcheck.git {}'.format(login, branch).split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + comm = p.communicate() + stdout = comm[0].decode(encoding='utf-8', errors='ignore') + stderr = comm[1].decode(encoding='utf-8', errors='ignore') + print(stdout) + print(stderr) + if stdout.find('CONFLICT') > 0 or stderr.find('CONFLICT') > 0: + print('FAIL; There was some conflict when rebasing the changes') + sys.exit(1) p = subprocess.Popen(['git', 'show', '--format=%an <%ae>', sha], stdout=subprocess.PIPE, stderr=subprocess.PIPE) comm = p.communicate()