+#################################################
+## Update Version Info
+function do_update() {
+ echo "VERSION UPDATE: Enter the version that comes after $version (or enter nothing to abort)"
+ read new_ver
+ if [ -n "$new_ver" ]; then
+ cd $workdir/$version/export
+ # create sql upgrade file
+ tpl="CRM/Upgrade/Incremental/sql/$new_ver.mysql.tpl"
+ if [ ! -f $tpl ]; then
+ echo "{* file to handle db changes in $new_ver during upgrade *}" > $tpl
+ fi
+ # escape regex special chars
+ arg=`echo "$version" | sed 's:[]\[\^\$\.\*\/]:\\\\&:g'`
+ for file in xml/version.xml sql/civicrm_generated.mysql; do
+ set -ex
+ git checkout $file
+ sed "s/$arg/$new_ver/" < $file > $file.tmp
+ mv $file.tmp $file
+ set +x
+ done
+ # print the diff directly to the screen
+ git diff | cat
+ echo "Push these changes? y/n"
+ read input
+ if [ "$input" = "y" ]; then
+ set -ex
+ git add xml/version.xml sql/civicrm_generated.mysql $tpl
+ git commit -m "Update version to $new_ver"
+ git push origin "$start_point"
+ set +x
+ else
+ do_update
+ fi
+ else
+ echo "No version entered. Aborting version update."
+ fi
+}
+