There are 2 possible ways to go, depending on the subversion client you have to use:
- TortoiseSVN: use the client hooks for that purpose
- SVN command client: use a shell script and some svn properties
TortoiseSVN Client Hooks
When you look at the chapter "Client Side Hook Scripts" of the TortoiseSVN Help, you will find the following section:
Start-commit
Called before the commit dialog is shown. You might want to use this if the hook modifies a versioned file and affects the list of files that need to be committed and/or commit message. However you should note that because the hook is called at an early stage, the full list of objects selected for commit is not available.
The hook has the following arguments:
- PATH: A path to a temporary file which contains all the paths for which the operation was started. Each path is on a separate line in the temp file.
- MESSAGEFILE: Path to a file containing the log message for the commit. The file contains the text in UTF-8 encoding. After successful execution of the start-commit hook, the log message is read back, giving the hook a chance to modify it.
- CWD: The current working directory with which the script is run. This is set to the common root directory of all affected paths.
So you have ingredients to implement a small script to change the svn commit template depending on the directory. However, you have to care how you can deploy the client hook, because each user has to install them on its own.
SVN command client script and svn:template-file property
- Define a shell script that will call the real subversion command inside.
- Define a svn property on directories with a useful name (like
template-file
) and search from the starting directory upwards a directory that has that svn property set.
- Use the found property as the file name to look up the contents (possibly should be an URL, so no local installation of these templates necessary).
- If none is found, use the default template.
However, you have to install that script on the client as well. There is no mechanism in Subversion that allows the usage of different templates without an additional installation on the client.