echo"Your version of git is too old. Install git 1.6."
exit 1
fi
# Check all parameters
VERSION=$1
MAJOR=${VERSION%.*}
REST=${VERSION##*.}
MINOR=${REST%%[a-z]*}
MICRO=`echo${REST} | sed's/^[0-9]*//g'`
MICROA=`echo${MICRO} | sed's/[^a-z]//g'`
MICROB=`echo${MICRO} | sed's/[a-z]//g'`
BRANCH=$2
drafts=$(ssh $USER@reviews.mahara.org -p 29418 gerrit query is:draft branch:$BRANCH project:mahara "label:Code-Review>=0""label:Verified>=0" | while read line
do
if[["$line"=~ rowCount:.*([0-9])]];then
if[["${BASH_REMATCH[1]}"!="0"]];then
echo"1"# we have some draft patches that match
fi
fi
done)
if[["$drafts"=="1"]];then
read-r-p"There are Draft patches that may need to be merged. Do you want to continue with release [y/n]?" response
response=${response,,}#to lower
if[[$response=~ ^(yes|y)$ ]];then
echo"Continuing..."
else
echo"Quitting out"
exit 1;
fi
fi
BUILDDIR=`mktemp-d /tmp/mahara.XXXXX`
CURRENTDIR="`pwd`"
SCRIPTDIR=$(readlink-f--"${0%/*}")
if[-z"${MAJOR}"]||[-z"${MINOR}"];then
print_usage
exit 1
fi
if[!-z"${MICRO}"]&&["${BRANCH}"!='master'];then
echo"* Micro version is ${MICRO} and this is a stable branch. Stuff may be wrong. *"
fi
mkdir-p${BUILDDIR}/mahara
pushd${BUILDDIR}/mahara
# Main Mahara repo to pull from
#PUBLIC="git@git.mahara.org:mahara/mahara.git"
PUBLIC="git@github.com:MaharaProject/mahara.git"
echo"Cloning public repository ${PUBLIC} in ${BUILDDIR}/mahara"
git init
git remote add -t${BRANCH} mahara ${PUBLIC}
git fetch mahara
git checkout -b${BRANCH} mahara/${BRANCH}
git fetch -t
# Apply patch files named on command line
patch=3
while[$patch-le$# ];do
git am ${!patch}
patch=$((patch+1))
done
# Edit ChangeLog
if[-z"${MICRO}"]&&[!-f"ChangeLog"];then
echo"The ChangeLog file is missing and this is a stable release. Create an empty file called ChangeLog and commit it."
exit 1
fi
RELEASE="${MAJOR}.${MINOR}${MICRO}"
echo-e"#\n# Please add a description of the major changes in this release, one per line.\n# Don't put a dash or asterisk at the front of each line, they'll get added automatically.\n# Also, don't leave any blank lines at the bottom of this file.\n#\n">${CURRENTDIR}/ChangeLog.temp