From aba0a124139011e1c1f617bd47b7cf21b89b36d2 Mon Sep 17 00:00:00 2001 From: heliclei Date: Fri, 25 Jul 2014 16:38:22 +0800 Subject: [PATCH] [ci skip][jenkins]merge pull request to latest baseline before build --- tools/jenkins-scripts/pull-request-builder.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/jenkins-scripts/pull-request-builder.py b/tools/jenkins-scripts/pull-request-builder.py index 7402a2a425..6df4550d8f 100755 --- a/tools/jenkins-scripts/pull-request-builder.py +++ b/tools/jenkins-scripts/pull-request-builder.py @@ -131,6 +131,8 @@ def main(): #reset path to workspace root os.system("cd " + os.environ['WORKSPACE']); + #pull latest code + os.system("git pull origin V3") os.system("git checkout v3") os.system("git branch -D pull" + str(pr_num)) #clean workspace @@ -142,9 +144,16 @@ def main(): if(ret != 0): return(2) - #checkout - git_checkout = "git checkout -b " + "pull" + str(pr_num) + " FETCH_HEAD" + #checkout a new branch from v3 + git_checkout = "git checkout -b " + "pull" + str(pr_num) os.system(git_checkout) + #merge pull reqeust head + p = os.popen('git merge --no-edit FETCH_HEAD') + r = p.read() + #check if merge fail + if r.find('CONFLICT') > 0: + print r + return(3) # After checkout a new branch, clean workspace again print "After checkout: git clean -xdf -f"