Subversion pre-commit hooks
I am using a wonderful source control product Subversion. More information is available on http://subversion.tigris.org
A great future of subversion is an ability to run a server script before the check-in is committed . The script has the ability to rollback the check-in. We are using this functionality to enforce comments for every check-in.
To create a script, place any executable file into a hooks folder in the repository. You can start with a pre-commit.tmpl template file that is located there already. The template is a perl script that accomplishes exactly that functionality.
Our subversion runs on a windows system, so we converted the perl script into a batch file
"c:\Program Files\Subversion\bin\svnlook.exe" log -t %2 %1 | FindStr [a-zA-Z0-9] IF %ERRORLEVEL% EQU 0 GOTO OK echo "Commit Comments are Required" >&2 exit 1 :OK exit 0
Place the code into a pre-commit.bat batch file in the hooks directory.
8 comments:
Exactly what I am looking for. Thanks!
Wonderful! I was battling with a script using grep, but this one worked first try.
Thank you!
Worked for me too! Thanks for posting. Not enough examples of Win based scripts out there.
You hero! Nice to see something simple.
Thank you, good sir.
Thanks for this. This should knock my lazy colleagues into shape!
Sweet! I'd been looking for a way to use findstr in this manner without resorting to temp files. Thanks a bunch!
Hi,
Thanks for the great script. It works sweet :)
Can you also guide on pre-commit script to enforce svn:needs-lock is set on all files
Post a Comment