|
|
@ -30,12 +30,18 @@ fi
|
|
|
|
# Check remote branch
|
|
|
|
# Check remote branch
|
|
|
|
branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"`
|
|
|
|
branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"`
|
|
|
|
if [[ -z "$branch" ]]; then
|
|
|
|
if [[ -z "$branch" ]]; then
|
|
|
|
branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
|
|
|
|
branch_detached=`git branch --contains HEAD | egrep "^\* \(HEAD detached at" | head -n1 | sed "s|^\* (HEAD detached at \([^)]*\)).*$|\1|"`
|
|
|
|
|
|
|
|
branch=`git tag | grep -Fx "${branch_detached}"`
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$branch" ]]; then
|
|
|
|
|
|
|
|
branch=`git branch -r --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
|
|
|
|
|
|
|
|
branch=${branch#origin/}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [[ -z "$branch" ]] ||
|
|
|
|
if [[ -z "$branch" ]] ||
|
|
|
|
[[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then
|
|
|
|
( [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]] &&
|
|
|
|
echo "There is not active upstream branch. Exiting..."
|
|
|
|
[[ -z "`git tag | grep -Fx \"${branch}\"`" ]] ); then
|
|
|
|
exit 1
|
|
|
|
echo "There is not active upstream branch. Exiting."
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Get submodule name
|
|
|
|
# Get submodule name
|
|
|
@ -82,12 +88,18 @@ if [ "$TARGET" != "${TARGET#3.5.}" ]; then
|
|
|
|
else
|
|
|
|
else
|
|
|
|
targetBranch=master
|
|
|
|
targetBranch=master
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$branch" = "v${TARGET}" ]; then
|
|
|
|
|
|
|
|
targetBranch=v${TARGET}
|
|
|
|
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if [ "$TARGET" != "${TARGET%.0}" ]; then
|
|
|
|
if [ "$TARGET" != "${TARGET%.0}" ]; then
|
|
|
|
targetBranch=master
|
|
|
|
targetBranch=master
|
|
|
|
else
|
|
|
|
else
|
|
|
|
targetBranch=r${TARGET%.*}.x
|
|
|
|
targetBranch=r${TARGET%.*}.x
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$branch" = "r${TARGET}" ]; then
|
|
|
|
|
|
|
|
targetBranch=r${TARGET}
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "$branch" != "$targetBranch" ]; then
|
|
|
|
if [ "$branch" != "$targetBranch" ]; then
|
|
|
|
echo "Target $TARGET is not valid on $branch branch. Exiting."
|
|
|
|
echo "Target $TARGET is not valid on $branch branch. Exiting."
|
|
|
@ -128,11 +140,15 @@ if [[ -n "$target_tag" ]] && \
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Calculate version
|
|
|
|
# Calculate version
|
|
|
|
tag=`git tag | \
|
|
|
|
if [[ -z "$target_tag" ]]; then
|
|
|
|
sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \
|
|
|
|
tag=`git tag | \
|
|
|
|
while read t; do \
|
|
|
|
sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \
|
|
|
|
git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \
|
|
|
|
while read t; do \
|
|
|
|
echo "$t..HEAD" && break; done`
|
|
|
|
git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \
|
|
|
|
|
|
|
|
echo "$t..HEAD" && break; done`
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
tag="$target_tag..HEAD"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
count=`git log $tag --pretty=oneline | wc -l`
|
|
|
|
count=`git log $tag --pretty=oneline | wc -l`
|
|
|
|
|
|
|
|
|
|
|
|