SVN pre-commit on CentOS
To help ensure your team is providing useful detail regarding svn check-ins a pre-commit can be used to valid the commit message. Additional checks can be done to valid the task number against your Redmine Database/Jira Database.
Locate your repository
/path/to/repository/
cd hooks
cp pre-commit.tmpl pre-commit
edit the pre-commit file and the add code similar to below
On the file is saved. Make is executable
chmod 775 pre-commit
A working script, CentOS(Linux) ver 6 using a Redmine database
The pre-commit code checks the SVN commit for:
1. There is a commit message
2. The message starts with "Issue #nnnn"
3. The issue number nnnn is in the Redmine issues table in MySQL
References:
http://www.redmine.org/boards/2/topics/449
http://lisa-n-tom.com/blog/?p=29
http://www.zytrax.com/tech/web/regex.htm#simple
http://stackoverflow.com/questions/8113289/svn-pre-commit-hook-failure
http://blog.grimsy.net/2008/07/a-few-svn-pre-commit-hooks/
http://svn.haxx.se/users/archive-2007-03/1180.shtml
http://tldp.org/LDP/abs/html/comparison-ops.html
http://linuxcommand.org/wss0090.php
http://www.computerhope.com/unix/mysql.htm
http://www.linuxtutorialblog.com/post/tutorial-conditions-in-bash-scripting-if-statements
Locate your repository
/path/to/repository/
cd hooks
cp pre-commit.tmpl pre-commit
edit the pre-commit file and the add code similar to below
On the file is saved. Make is executable
chmod 775 pre-commit
A working script, CentOS(Linux) ver 6 using a Redmine database
The pre-commit code checks the SVN commit for:
1. There is a commit message
2. The message starts with "Issue #nnnn"
3. The issue number nnnn is in the Redmine issues table in MySQL
References:
http://www.redmine.org/boards/2/topics/449
http://lisa-n-tom.com/blog/?p=29
http://www.zytrax.com/tech/web/regex.htm#simple
http://stackoverflow.com/questions/8113289/svn-pre-commit-hook-failure
http://blog.grimsy.net/2008/07/a-few-svn-pre-commit-hooks/
http://svn.haxx.se/users/archive-2007-03/1180.shtml
http://tldp.org/LDP/abs/html/comparison-ops.html
http://linuxcommand.org/wss0090.php
http://www.computerhope.com/unix/mysql.htm
http://www.linuxtutorialblog.com/post/tutorial-conditions-in-bash-scripting-if-statements
Comments
Post a Comment