Merge "Make requirement update proposals more robust."

This commit is contained in:
Jenkins 2014-02-06 22:15:36 +00:00 committed by Gerrit Code Review
commit 6a94aa26c2

View File

@ -16,6 +16,7 @@ INITIAL_COMMIT_MSG="Updated from global requirements"
TOPIC="openstack/requirements" TOPIC="openstack/requirements"
USERNAME=${USERNAME:-$USER} USERNAME=${USERNAME:-$USER}
BRANCH=$ZUUL_REF BRANCH=$ZUUL_REF
ALL_SUCCESS=0
if [ -z "$BRANCH" ] ; then if [ -z "$BRANCH" ] ; then
echo "No branch set, exiting." echo "No branch set, exiting."
@ -60,11 +61,8 @@ EOF
# make sure the project even has this branch # make sure the project even has this branch
if git branch -a | grep -q "^ remotes/origin/$BRANCH$" ; then if git branch -a | grep -q "^ remotes/origin/$BRANCH$" ; then
git checkout $BRANCH git checkout origin/${BRANCH}
git review -s git review -s
if [ -n "$change_id" ] ; then
git review -d $change_id
fi
popd popd
python update.py $PROJECT_DIR python update.py $PROJECT_DIR
@ -73,15 +71,22 @@ EOF
if ! git diff --exit-code HEAD ; then if ! git diff --exit-code HEAD ; then
# Commit and review # Commit and review
git_args="-a -F-" git_args="-a -F-"
if [ -n "$change_id" ] ; then
git_args="--amend $git_args"
fi
git commit $git_args <<EOF git commit $git_args <<EOF
$COMMIT_MSG $COMMIT_MSG
EOF EOF
git review -t $TOPIC $BRANCH # Do error checking manually to ignore one class of failure.
set +e
OUTPUT=$(git review -t $TOPIC $BRANCH)
RET=$?
[[ "$RET" -eq "0" || "$OUTPUT" =~ "no new changes" ]]
SUCCESS=$?
[[ "$SUCCESS" -eq "0" && "$ALL_SUCCESS" -eq "0" ]]
ALL_SUCCESS=$?
set -e
fi fi
fi fi
popd popd
done done
exit $ALL_SUCCESS