I primarily wanted to change my default commit template(svn-commit.tmp) on the fly when I do a svn commit. I got the knew from forums that setting the SVN_EDITOR would help
setenv SVN_EDITOR "rm svn-commit.tmp && cp $REPO/hooks/log.tmpl svn-commit.tmp && emacs"
But this would happen only if the user sets the SVN_EDITOR
in his user environment as above.
So is there any other explicit way that when I do a svn commit, I will open a template file from a different location rather than the default one. The commit template would be more specific to repositories and the date of commit. So is there a way where I can set some property on the svn repository to invoke a different commit template.
I should enforce it to all(repository specific) and it should not be user-specific like setting the SVN_EDITOR. Even if we are setting the SVN_EDITOR
can this setting be called when we do a svn commit by calling some hooks. I understand that pre & post commit hooks will be called only after the commit is submitted.
We only use the svn command client.
There are 2 possible ways to go, depending on the subversion client you have to use:
TortoiseSVN Client Hooks
When you look at the chapter "Client Side Hook Scripts" of the TortoiseSVN Help, you will find the following section:
The hook has the following arguments:
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
template-file
) and search from the starting directory upwards a directory that has that svn property set.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.
Here is one I created. It attempts to use the TortoiseSVN template if it exists, otherwise it looks for a template file in the global Git config, else it falls back to a built in template.
Note that using the standard TortoiseSVN template property does not mean you have to have TortoiseSVN installed.