Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
A pre-commit hook script scenario:

Whenver a user tries to check-in the code into the svn repository, a sonar analysis must be done. If there are any violations, the commit must not not be allowed.
I am new to this. So please guide me.
Posted

Please refrain from such hooks. If your code base is considerable in size, it may take a lot of time to check in based on the amount of time required to analyse.

You should take a look at continuous build integration servers. These do a build and analysis in background.
 
Share this answer
 
Comments
Reshma Babu 2-Jan-14 0:56am    
Ya.. I do agree with u on this.
But, I have to solve the scenario given to me, have no ther choice :(
I have create a .exe file, which calls the .bat file and runs the analysis. Based on certain error messages in the log file generated during the analysis, I will set the exit code of the .exe file. If exit 0, commit succeeds, else fails.

This link helped a lot:

TortoiseSVN pre-commit hook in C# - Save yourself some troubles![^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900