[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Post-commit script fails after upgrading to svn 0.35.1

From: Stuart Robertson <dogmatix_at_absolutesys.com>
Date: 2004-01-08 16:11:17 CET

Hi,
 
I recently upgraded from svn 0.32.1 to svn 0.35.1, doing the whole DB dump/load thing, etc. The new repository itself is working fine, and access via http is a lot faster. Very nice indeed.
 
However, I have a small shell script that generates a summary of each commit and mails the summary to all interested parties. Before upgrading to v0.35.1, everything worked fine. Now, however, when the script runs "svnlook changed", "svnlook author", etc. no information is returned. This only occurs when the script is invoked by post-commit by SVN itself. If I run post-commit manually (passing in the full repository path and the latest revision number), then everything works ok. The summary email is correctly generated, etc.
 
I guessed that, perhaps the new SVN 0.35.1 is doing more aggressive caching and delaying writing to disk to improve performance, and so perhaps my email-generation script was being run by post-commit too soon after the commit. To test this, I inserted "sleep 60" at the start of the email-generation script. To no avail. Next I tried adding "sync" to the start of the script. Still no success.
 
Has anyone else encountered a problem like this?
 
During further reading I found some notes about possibly performing "deltafication" as a background task launched via post-commit. I'm not sure what deltafication is, so I haven't pursued this option yet.
 
For reference, below are complete copies of my post-commit and email-generation scripts, along with an example of a "successful" email and one of the new "failed" emails.
 
===========================================================================
post-commit:
===========================================================================
#!/bin/sh
 
# POST-COMMIT HOOK
#
# The post-commit hook is invoked after a commit. Subversion runs
# this hook by invoking a program (script, executable, binary,
# etc.) named `post-commit' (for which
# this file is a template) with the following ordered arguments:
#
# [1] REPOS-PATH (the path to this repository)
# [2] REV (the number of the revision just committed)
#
# Because the commit has already completed and cannot be undone,
# the exit code of the hook program is ignored. The hook program
# can use the `svnlook' utility to help it examine the
# newly-committed tree.
 
REPOS="$1"
REV="$2"
 
# Generate and send a commit-summary email. Do this as a background
# task so the commit can complete quickly (otherwise the SVN client
# is kept waiting until the email has been sent).
$REPOS/hooks/generateAndSendPostCommitEmail $REPOS $REV &

===========================================================================
generateAndSendPostCommitEmail:
===========================================================================
#!/bin/sh

# This script is called by the Post-Commit hook script in order
# to generate an email summarizing the changes made by the commit.
#
# The generated email is sent to all email addressed listed in
# the $REPOS/email/watchers file.
#
# [1] REPOS-PATH (the path to this repository)
# [2] REV (the number of the revision just committed)
#

# Try sleeping a while to see if SVN is happier after a little nap?
sleep 60

REPOS=$1
REV=$2
AUTHOR=`svnlook -r $REV author $REPOS`
WATCHERS=`cat $REPOS/email/watchers`
MSG=$REPOS/email/emails/$REV.CommitNotice.txt

# Try forcing the file system to be flushed to disk before sending the email???
sync

# Construct the actual commit-summary email message's body
echo "Revision $REV committed on $REPOS" > $MSG

echo " " >> $MSG
echo "******************************************************************************" >> $MSG
echo "* SUMMARY *" >> $MSG
echo "******************************************************************************" >> $MSG
DATE=`date`
echo "Date: $DATE" >> $MSG
echo "Committer: $AUTHOR" >> $MSG
echo "Repository: $REPOS" >> $MSG

echo " " >> $MSG
echo "COMMIT MESSAGE:" >> $MSG
echo "--------------" >> $MSG
svnlook log -r $REV $REPOS >> $MSG

echo " " >> $MSG
echo "CHANGED FILES:" >> $MSG
echo "-------------" >> $MSG
svnlook changed -r $REV $REPOS >> $MSG

echo " " >> $MSG
echo "******************************************************************************" >> $MSG
echo "* DETAILED CHANGES *" >> $MSG
echo "******************************************************************************" >> $MSG
svnlook diff -r $REV $REPOS >> $MSG

# Send the generated commit-summary message to all team members
sudo -u svn /bin/mail -s "New Commit - $REPOS" $WATCHERS < $MSG

# Remove the (temporary) generated commit-message.
rm $MSG

===========================================================================
Successful Email (as things used to be before moving to SVN 0.35.1)
===========================================================================
Revision 775 committed on /svnrepos/InteractToolsuite.V1
 
******************************************************************************
* SUMMARY *
******************************************************************************
Date: Thu Jan 8 10:00:26 SAST 2004
Committer: srobertson
Repository: /svnrepos/InteractToolsuite.V1
 
COMMIT MESSAGE:
--------------
Second-last step testing new email system.
 
CHANGED FILES:
-------------
U trunk/absINTERACT/src/build.xml
 
******************************************************************************
* DETAILED CHANGES *
******************************************************************************
Modified: trunk/absINTERACT/src/build.xml
===================================================================
--- trunk/absINTERACT/src/build.xml 2004-01-06 09:11:57 UTC (rev 774)
+++ trunk/absINTERACT/src/build.xml 2004-01-06 09:18:37 UTC (rev 775)
@@ -3,6 +3,7 @@
      # PROPERTIES
+ <property name="final.testing" value="abc"/>
         <property name="build.compiler" value="jikes"/>
         <property name="AbsINTERACT.Dir" value="${basedir}/.."/>
         <property name="Archive.OutputDir" value="/"/>

===========================================================================
Failed Email (as things are now, after moving to SVN 0.35.1)
===========================================================================
Revision 775 committed on /svnrepos/InteractToolsuite.V1
 
******************************************************************************
* SUMMARY *
******************************************************************************
Date: Thu Jan 8 10:00:26 SAST 2004
Committer:
Repository: /svnrepos/InteractToolsuite.V1
 
COMMIT MESSAGE:
--------------
Second-last step testing new email system.
 
CHANGED FILES:
-------------

 
******************************************************************************
* DETAILED CHANGES *
******************************************************************************

Any help and/or suggestions will be appreciated.

Regards,
Stuart.

___________
DISCLAIMER: This information is intended only for the person or entity to which it is addressed and may contain private, confidential, proprietary and/or privileged material and may be subject to confidentiality agreements. Any review, retransmission, dissemination, or any other use of or taking of any action in reliance upon this information, by persons or entities other than the intended recipient, is prohibited. If you received this in error, please contact the sender and delete the material from all storage media.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jan 8 20:33:12 2004

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.