Pre-commit hook function:
[Email protected] hooks]# Cat/application/svndata/sadoc/hooks/pre-commit
#!/bin/bash
#Check Message lenth---to force the input information to be less than 5 characters when you update the version Inode exit
Repos= "$"
Txn= "$"
Logmsg= ' Svnlook log-t $TXN $REPOS |grep "[a-za-z0-9]" |wc-c "
If [$logmsg-lt 5];then
Echo $logmsg 1>&2
ECHO-E "\nlog message is too short" >&2
Exit 3
Fi
#Check upload filesize---Check file size
max_size=1024000---threshold value
Svnlook=/usr/bin/svnlook
files=$ ($SVNLOOK changed-t $TXN $REPOS | grep "^a " |awk ' {print $} ')
---Remove status is the list of added files (A: Indicates add )
For F in $files
Do
filesize=$ ($SVNLOOK cat-t $TXN $REPOS $f | wc-c)---judging size
If [$filesize-gt $MAX _size];then
echo "The new Add File $f is too large (must <= $MAX _size)" >&2
Exit 1
Fi
Done
Exit 0
Remember to add Execute permission Oh ~ ~
Here is a detailed explanation of the parameters of each command and some other things ...
Http://www.subversion.org.cn/svnbook/1.4/svnbook.html
Http://www.subversion.org.cn/svnbook/nightly/svn.ref.svnlook.c.cat.html
SVN Note--hooks