windowssvnsvn-hooks

Is there an SVN equivalent to the git prepare commit message hook


I want to edit the incoming commit messages (adding branch name, or add a template that has some lines ignored etc). While I was searching I found that git has a prepare commit message hook that seems to do this but svn doesn't. Is there a way to do this in svn before the post commit?


Solution

  • In SVN you do not need to use hook scripts to add log message templates:

    I guess that you already use TortoiseSVN client since the question is marked with tag. TortoiseSVN supports several properties that should help you define the behavior of the client. They will help you implement commit policies including log message restrictions and templates:

    See the TortoiseSVN Project Properties chapter of the manual for complete list of properties and their purpose.


    You must use git's pre-commit hooks to validate the log messages and add commit message templates. If you don't do this, the procedure to fix the mistakes in log messages requires you to use git rebase that can be non-trivial. There could be other ways to add log message policies, but in git's world you have to use hook scripts for this.

    Don't forget that svn commit and git commit operations play different roles in common workflows with git or SVN. The whole idea and results of svn commit and git commit operations is different. Consequently, *-commit hooks have different goals in both systems: