SVN Note--hooks

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.