views:

316

answers:

4

Is it possible to make svn run some command before every commit? I have some documentation in LaTeX in the repository and would like to have always the latest version of the compiled docs available as a pdf in the repository. The same would go with doxygen docs.

I'd bet that there is some magic svn:something property or something like that, but haven't found anything yet. Thanks.

Edit: Thanks for the answers, but as far as I understand it hooks run on the server. In this case I don't have access to the server (the project is hosted on Assembla). Is there any way to do these things on a client?

+7  A: 

You can easily do the reverse. Create a shell script that runs svn commit after building stuff.

Mehrdad Afshari
A: 

Use a pre-commit hook

Alex Spurling
pre-commit hooks should *not* modify what is being committed. See http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks
Sander Rijken
Absolutely, I'm not aware that that is what I suggested. As far as I understand the questions was about how to trigger automatic generation of documentation.
Alex Spurling
+1  A: 

All of these actions are controlled on the server side. Look into the repository directory and you'll find a hooks folder with a ton of sample scripts. You want the pre-commit hook.

Keep in mind that if you are running the server on windows, that these scripts are executed with no environment, so don't assume that a path is set and use absolute paths.

Brian Fox
pre-commit hooks should *not* modify what is being committed. See http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks
Sander Rijken
+2  A: 

If you auto-generate the documentation, why put it in the repository at all? You create it every time, so there's no point in having it versioned too (it's generated after all). I'd rather use a pre-commit hook to generate the documentation and put it into a common place to access it than storing it in the repository -- storing it in the repository is creating redundancy which should be avoided from my point of view.

(And I agree that pre-commit hooks should not modify what's being committed :)

bluebrother