On May 20, 2012, at 16:16, Ted Byers wrote:
> I have just installed subversion on a Ubuntu VM, and trying to learn how to administer both. I have successfully created my first VN repository. :-)
>
> Now, I have read through the documentation a couple times, and know what hooks are and why they're used, but I am not clear on how to write one as the examples I have found so far are written in programming languages I don't know (such as Python).
>
> In the first project I am going to put into this repository, I am writing a test suite based on Boost's Test library (written in C++). What I want to do is write a program that assesses code coverage, so that all new code has at least one unit test, and then require that the codebase, including all existing and new tests, compile and execute successfully; and have a precommit hook that prevents a commit unless this test suite program indicates that the tests all passed. I have read arguments that recommend against this, claiming it can slow down commits, but then I am more concerned about code quality, and always having a codebase, which to me includes all tests, that compiles and runs properly than I am in the convenience of any programmers working on the project. I also write in Perl and JavaScript (and not so much anymore in Java or C#), so I will want the same requirement on all code in all the languages I routinely use.
>
> Can anyone either show me how to write such a pre-commit hook, or point me to examples that would show how to do this?
You should be able to write Subversion hook scripts in whatever language you like. I used PHP before, but now that I've jumped into using node.js for web development, writing one in JavaScript would be fun. I don't have an example handy at this time. But there should be tons of examples using Perl.
Received on 2012-05-21 03:00:16 CEST