From 8bff19b1600394d8ef3fcda4fb9e2e96e3a86428 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 4 Jun 2012 13:52:56 -0700 Subject: [PATCH] Use gerrit-git-prep. Change-Id: Ia702897e604aca65435964a467d5b602a9921ed4 --- devstack-vm-gate-wrap.sh | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/devstack-vm-gate-wrap.sh b/devstack-vm-gate-wrap.sh index bd3f2a63..a3741b13 100755 --- a/devstack-vm-gate-wrap.sh +++ b/devstack-vm-gate-wrap.sh @@ -45,42 +45,39 @@ fi cd $WORKSPACE -for PROJECT in $PROJECTS +ORIGINAL_GERRIT_PROJECT=GERRIT_PROJECT +ORIGINAL_GERRIT_BRANCH=GERRIT_BRANCH + +for GERRIT_PROJECT in $PROJECTS do - echo "Setting up $PROJECT" - SHORT_PROJECT=`basename $PROJECT` + echo "Setting up $GERRIT_PROJECT" + SHORT_PROJECT=`basename $GERRIT_PROJECT` if [[ ! -e $SHORT_PROJECT ]]; then echo " Need to clone" - git clone https://review.openstack.org/p/$PROJECT + git clone https://review.openstack.org/p/$GERRIT_PROJECT fi cd $SHORT_PROJECT - BRANCH=$GERRIT_BRANCH + GERRIT_BRANCH=$ORIGINAL_GERRIT_BRANCH # See if this project has this branch, if not, use master - git remote update + git remote update || git remote update # attempt to work around bug #925790 # Ensure that we don't have stale remotes around git remote prune origin if ! git branch -a |grep remotes/origin/$GERRIT_BRANCH>/dev/null; then - BRANCH=master + GERRIT_BRANCH=master fi - git reset --hard - git clean -x -f -d -q - git checkout $BRANCH - git reset --hard remotes/origin/$BRANCH - git clean -x -f -d -q + + export GERRIT_BRANCH + export GERRIT_PROJECT + /usr/local/jenkins/slave_scripts/gerrit-git-prep.sh review.openstack.org - if [[ $GERRIT_PROJECT == $PROJECT ]]; then - echo " Merging proposed change" - git fetch https://review.openstack.org/p/$PROJECT $GERRIT_REFSPEC - git merge FETCH_HEAD - else - echo " Updating from origin" - git pull --ff-only origin $BRANCH - fi cd $WORKSPACE done +GERRIT_PROJECT=$ORIGINAL_GERRIT_PROJECT +GERRIT_BRANCH=$ORIGINAL_GERRIT_BRANCH + # Set GATE_SCRIPT_DIR to point to devstack-gate in the workspace so that # we are testing the proposed change from this point forward. GATE_SCRIPT_DIR=$WORKSPACE/devstack-gate