update tag-release git command to fall back to master

The release tagging script relied on the zuul-cloner behavior of falling
back to master if the requested branch did not exist. Add logic to the
shell command replacement to do the same thing, with a warning.

I tested this locally on the Oslo releases today, and it worked. Before
the change release.sh failed because it could not check out the
stable/newton branch of openstack/requirements to submit the patch to
update the constraints list.

Change-Id: Ib29a68edbb5bfea64625128da35ddad61098dd9c
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-08-02 14:12:16 -04:00
parent 1a2539a225
commit 881f3cc666

View File

@ -93,9 +93,14 @@ function clone_repo {
# them for building the release notes.
(cd $repo && git fetch -v --tags)
# Make sure the active branch is set correctly.
# Make sure the active branch is set correctly, if the branch
# exists.
if [ ! -z "$branch" ]; then
(cd $repo && git checkout $branch)
if git show origin/$branch; then
(cd $repo && git checkout $branch)
else
echo "Branch $branch does not exist, using master."
fi
fi
return 0