笔者的环境是linux 5.8 和 Python2.7
1. 配置hook 文件
点击(此处)折叠或打开
- mv //hooks/post-commit.tmpl />/hooks/post-commit
- chmod +x />/hooks/post-commit
- [root@system smu]# tail />/hooks/post-commit
- REPOS="$1"
- REV="$2"
- /usr/share/doc/subversion-1.6.11/tools/hook-scripts/mailer/mailer.py commit "$REPOS" "$REV" />/hooks/mailer.conf
2. 配置邮件mailer.conf
- mail_command = /usr/sbin/sendmail
- smtp_hostname = localhost
- from_addr = fromsome@abc.com
- to_addr = tosome@abc.com
3. 其他方法
除了用svn自带的邮件通知工具,也可以用其他的方法来实现- #!/bin/sh
- REPOS="$1"
- REV="$2"
- AUTHOR=$(svnlook author -r $REV $REPOS)
- DATE=$(svnlook date -r $REV $REPOS)
- {
- echo "REPOSITORY: $REPOS"
- echo "REVISION: $REV"
- echo "COMMITTED BY: $AUTHOR"
- echo "DATE: $DATE"
- echo ""
- echo "DESCRIPTION:"
- svnlook log -r $REV $REPOS
- echo ""
- echo "FILES:"
- svnlook changed -r $REV $REPOS
- } | mail -s "PerfPortal Check In Rev $REV by $AUTHOR" "[email protected]"