From eb27eead4c186c2c155311497b47a74a23c02c9c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 3 Apr 2014 21:58:03 +0200 Subject: [PATCH] attempt to fix detection --- scripts/jenkins_script.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/jenkins_script.py b/scripts/jenkins_script.py index 1e3f3945d..8767910d0 100644 --- a/scripts/jenkins_script.py +++ b/scripts/jenkins_script.py @@ -40,6 +40,7 @@ You can look up the token in the Branch-01-Pull job configuration or ask in IRC. """ from optparse import OptionParser +import re from requests.exceptions import HTTPError from subprocess import Popen, PIPE import sys @@ -137,10 +138,17 @@ def get_repo_name(): # Determine the branch's name repo_name = '' for line in output_list: - match = re.match(REPO_REGEX, line) - if match: - repo_name = 'lp:%s' % match.group(2) - break + # Check if it is remote branch. + if 'push branch' in line: + match = re.match(REPO_REGEX, line) + if match: + repo_name = 'lp:%s' % match.group(2) + break + elif 'checkout of branch' in line: + match = re.match(REPO_REGEX, line) + if match: + repo_name = 'lp:%s' % match.group(2) + break repo_name = repo_name.strip('/') # Did we find the branch name?