Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion Hook

I am working in a project where there are configuration files, one in number for each of the environments where the application would be deployed.

When a developer modifies one of these files, the developer should not be allowed to check-in the file individually, but check-in all the files together or at least the developer should be informed that this needs to be done.

How can we achieve it?

like image 943
Shyam Avatar asked Nov 24 '08 11:11

Shyam


People also ask

What is a SVN hook?

A hook is a specifically named program that is called by the Subversion server during the execution of some operations. There are exactly nine hooks which must reside under the hooks directory in the repository. When you create a new repository, you get nine template files in this directory, all of them having the .

What is post commit hook in SVN?

The post-commit hook is run after the transaction is committed and a new revision is created. Most people use this hook to send out descriptive emails about the commit or to notify some other tool (such as an issue tracker) that a commit has happened. Some configurations also use this hook to trigger backup processes.

What is pre commit hook in SVN?

A pre-commit hook is a feature available in the Subversion version control system that allows code to be validated before it is committed to the repository. The PHP_CodeSniffer pre-commit hook allows you to check code for coding standard errors and stop the commit process if errors are found.

Where are SVN hooks stored?

Subversion Hooks are located in your repository directory (so if you have multiple repositories you have to setup hooks for each one) in a directory called hooks , perhaps something like this: /home/svn/projectName/hooks .


1 Answers

I would think you could write a pre-commit hook to do this - just have a list of files where if one is committed then they must all be committed.

You can write hooks in any language that you can write a command-line application in. The only gotcha is that they run in the context of the SVN server, and (at least traditionally, I don't know if this is improved), they aren't given much environment when they start - you can be caught out by a lack of 'PATH' for example.

Your repository will have example batchfile/shell-script hooks in the 'hooks' directory, but I've also written them in C# in the past.

This http://wordaligned.org/articles/a-subversion-pre-commit-hook looks like a good general introduction to pre-commit hooks.

like image 169
Will Dean Avatar answered Nov 07 '22 21:11

Will Dean