Check that the target branch exists

* propose_requirements_update.sh: Look before we leap. Don't descend
into the project repository and try to check out a branch without
first making sure it exists on the origin.

Change-Id: Ib4de5bdf8bf5cf134e3307755617456f282d790d
This commit is contained in:
Jeremy Stanley 2013-12-11 16:32:11 +00:00
parent 5ad56c346e
commit dde1d73058

View File

@ -56,29 +56,32 @@ EOF
PROJECT_DIR=$(basename $PROJECT)
rm -rf $PROJECT_DIR
git clone ssh://$USERNAME@review.openstack.org:29418/$PROJECT.git
pushd $PROJECT_DIR
git checkout $BRANCH
git review -s
if [ -n "$change_id" ] ; then
git review -d $change_id
fi
popd
python update.py $PROJECT_DIR
pushd $PROJECT_DIR
if ! git diff --exit-code HEAD ; then
# Commit and review
git_args="-a -F-"
# make sure the project even has this branch
if git branch -a | grep -q "^ remotes/origin/$BRANCH$" ; then
git checkout $BRANCH
git review -s
if [ -n "$change_id" ] ; then
git_args="--amend $git_args"
git review -d $change_id
fi
git commit $git_args <<EOF
popd
python update.py $PROJECT_DIR
pushd $PROJECT_DIR
if ! git diff --exit-code HEAD ; then
# Commit and review
git_args="-a -F-"
if [ -n "$change_id" ] ; then
git_args="--amend $git_args"
fi
git commit $git_args <<EOF
$COMMIT_MSG
EOF
git review -t $TOPIC $BRANCH
git review -t $TOPIC $BRANCH
fi
fi
popd
popd
done