Hi all, Here is the update patch.
*) Remove IGNORE_BRANCHES *) Add BRANCH_REGEXP *) Remove '-n' from echo command line, use the original DATESTAMP format *) Update PATH as Gerald recommend *) Fix a typo in patch of hooks/post-commit *) Write svn commit error messages to svn client as Gerald recommend post-commit | 6 ++++++ update_datestamp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) Index: hooks/update_datestamp =================================================================== --- hooks/update_datestamp (revision 0) +++ hooks/update_datestamp (revision 0) @@ -0,0 +1,52 @@ +#!/bin/sh + +REPOS="$1" +REV="$2" + +PATH=/usr/bin:/bin +BRANCH_REGEXP="^trunk/|^branches/gcc-[0-9]+_[0-9]+-branch/" + +# Run this from /tmp +/bin/rm -rf /tmp/$$ +/bin/mkdir /tmp/$$ +cd /tmp/$$ + +# Compute the branches which we should check for update. +BRANCHES=`svnlook -r ${REV} dirs-changed "${REPOS}" \ +| grep -E "${BRANCH_REGEXP}" \ +| awk -F '/' '{if ($1 == "trunk") { print $1} else { print $2}}' \ +| sort -u` + +# Assume all will go well. +RESULT=0 +for BRANCH in ${BRANCHES}; do + + # Compute the DATESTAMP URL we should check for update. Since svn + # does not support checkout files, so we use the parent directory. + if test "${BRANCH}" = "trunk"; then + DATESTAMP_URL="file://${REPOS}/trunk/gcc" + else + DATESTAMP_URL="file://${REPOS}/branches/${BRANCH}/gcc" + fi + + CURR_DATE=`/bin/date -u +"%Y%m%d"` + PREV_DATE=`svn cat "${DATESTAMP_URL}/DATESTAMP"` + if test "${CURR_DATE}" = "${PREV_DATE}"; then + continue + fi + + svn -q co -N "${DATESTAMP_URL}/" gcc + echo ${CURR_DATE} > gcc/DATESTAMP + if ! svn commit -m "Daily bump." gcc/DATESTAMP; then + # If we could not commit the files, indicate failure. + # The commiter will see the failure message from the svn client. + RESULT=1 + fi + + # Remove the files. + rm -rf /tmp/$$/gcc +done + +/bin/rm -rf /tmp/$$ + +exit $RESULT Property changes on: hooks/update_datestamp ___________________________________________________________________ Added: svn:executable + * Index: hooks/post-commit =================================================================== --- hooks/post-commit (revision 169782) +++ hooks/post-commit (working copy) @@ -17,3 +17,9 @@ --repository "${REPOS}" --revision "${REV}" --background ${REPOS}/hooks/synchooks.sh "${REPOS}" "${REV}" + +ERROR_MESSAGES=`${REPOS}/hooks/update_datestamp ${REPOS} ${REV} 2>&1 >/dev/null` +ERROR_CODE="$?" +echo ${ERROR_MESSAGES} >&2 + +exit ${ERROR_CODE} -- Dongsheng Song