For our (AuScope/CSIRO) svn repos, we have an svn pre-commit script that 
uses svnlook to require a log message and to prevent commits to tags. 
Commits to tags are usually unintended and always ill-advised.

Would the GT-dev community like to adopt a must-have-logs and 
no-commits-to-tags policy and enforce it using this script?

hooks/pre-commit:


#!/bin/sh

#   [1] REPOS-PATH   (the path to this repository)
#   [2] TXN-NAME     (the name of the txn about to be committed)
#

REPOS="$1"
TXN="$2"

noLogMessage() {
     echo "Please provide a log message" >&2
     exit 1
}

# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
     grep "[a-zA-Z0-9]" >/dev/null || noLogMessage

TAGS_REGEX='tags/[^/]\+'
# Get list of transactions in the 'tag' directory
TAGS_CHANGES=`"$SVNLOOK" changed -t "$TXN" "$REPOS" 2>/dev/null | \
                  awk '{ print $2; }' 2>/dev/null | \
                  grep ^tags/ 2>/dev/null | \
                  sed -e "s!^\($TAGS_REGEX\).*!\1!" | \
                  sort | \
                  uniq`
# Get head revision number
YOUNGEST=`svnlook youngest "$REPOS" 2>/dev/null`
# For every line in transaction,
# check to see if directory in tags exists
for CHANGE in $TAGS_CHANGES; do
   # If directory in tags exists, deny transaction
   if svnlook proplist -r $YOUNGEST "$REPOS" "$CHANGE" >/dev/null 2>&1 ;
then
     echo "Cannot modify existing tag: ${tag}" >&2
     exit 1
   fi
done


# All checks passed, so allow the commit.
exit 0



-- 
Ben Caradoc-Davies <[email protected]>
Software Engineer, CSIRO Exploration and Mining
Australian Resources Research Centre
26 Dick Perry Ave, Kensington WA 6151, Australia

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to