Help needed with a Windows SVN hook which looks for a certain word in the comment?

Coder
Coder
I am trying to implement a pre-commit subversion hook which looks for a pattern in the commit comment? Any pointers on how to do this? Like whenever someone tries to check in a file, I want to look for the word 'ABCD' in the comment they have entered along with forcing them to enter a comment. I have searched everywhere but simply couldn't find a hook that does the above. Any help will be greatly appreciated.

Last updated

orbrey
orbrey
Hi there,  This should work for you - though you'll need to make sure you put in the correct path to svnlook.exe in the quotes and change 'ABCD' to the actual string you require to be in there:   "C:\Program Files\WANdisco\Subversion\svnlook.exe" log -t %2 %1 | FindStr ABCD IF %ERRORLEVEL% EQU 0 GOTO OK echo "Commit message must contain ABCD" >&2 exit 1 :OK exit 0   Hope that helps.
Coder
Coder
Thanks a ton for your help orbrey. Much appreciated.
Coder
Coder
Sorry, a quick question..Whats the svnlook.exe path pointing to?  I can only see this path on my computer  C:\Program Files\TortoiseSVN
orbrey
orbrey
That'd be the one - if you look in that folder you should see svnlook.exe in there :)  EDIT: Apologies, the path I quoted above is taken from my command line Subversion install. If you look in the bin folder in the TortoiseSVN folder you posted above you should find svnlook.exe in there.
faizan123
faizan123


That list command gives an error when the directory does not exist. That only works if the directory already exist. How do I handle the error when the directory does not exist ?
 
   

   
rechly140
rechly140
Great information, i read your all post. Thanks  Rechly Parker IT Analyst SageNext Infotech LLC

1-7 of 7

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.