#函数功能:git库打标签
function make_git_tag()
{
if [ "NULL" != $BRANCH_NAME ];then
run_cmd "git checkout $BRANCH_NAME"
fi
run_cmd "git tag -a $TAG_NAME -m "$TAG_NAME""
local REMOTE_NAME=`git remote show`
run_cmd "git push $REMOTE_NAME --tags"
}
######################################## main program start ##########################################
if [ $# != 3 ];then
echo "[$0,Line:$LINENO] Error: The Number of parameter is incorrect"
exit 1
fi
REPOSITORY_LOCAL_PATH=$1
TAG_NAME=$2
BRANCH_NAME=$3
pushd $REPOSITORY_LOCAL_PATH
if [ -d ".repo" ];then
make_repo_tag
popd
elif [ -d ".git" ];then
make_git_tag
popd
else
echo "[$0,Line:$LINENO] Error: The Path has not a .git or .repo!"
exit 1
fi
######################################## main program end ##########################################
function make_git_tag()
{
if [ "NULL" != $BRANCH_NAME ];then
run_cmd "git checkout $BRANCH_NAME"
fi
run_cmd "git tag -a $TAG_NAME -m "$TAG_NAME""
local REMOTE_NAME=`git remote show`
run_cmd "git push $REMOTE_NAME --tags"
}
######################################## main program start ##########################################
if [ $# != 3 ];then
echo "[$0,Line:$LINENO] Error: The Number of parameter is incorrect"
exit 1
fi
REPOSITORY_LOCAL_PATH=$1
TAG_NAME=$2
BRANCH_NAME=$3
pushd $REPOSITORY_LOCAL_PATH
if [ -d ".repo" ];then
make_repo_tag
popd
elif [ -d ".git" ];then
make_git_tag
popd
else
echo "[$0,Line:$LINENO] Error: The Path has not a .git or .repo!"
exit 1
fi
######################################## main program end ##########################################

被折叠的 条评论
为什么被折叠?



