I want to get the list of commits since the last release, but since I have a lot of git repos to examine, I would like to do it via the bitbucket rest API instead of cloning each and every git repo I want to test.
If I do have a clone, my problem is simple:
#!/bin/bash
git tag | grep '<release-tag-regexp>' | sort <in-descending-order>' \
| while read tag
do
tag_sha1="$(git rev-parse "$tag^{commit}")"
ancestor="$(git merge-base HEAD $tag)"
if [ $ancestor = $tag_sha1 ]
then
echo "Closest release tag is: $tag"
exit 1
fi
done
if [ $? -eq 0 ]
then
echo "No release tag found which is an ancestor of HEAD"
fi
I wished bitbucket had a rest call for this query. As it looks, I seem to have no choice but to use the commit log and the tag list and construct a map myself.