Search code examples
svnvisualsvnvisualsvn-serversvn-hooks

How can I get more relevant information in VisualSVN hooks?


Subversion (VisualSVN in my case) allow you to kick off scripts at various times, such as pre-commit, post-commit etc. I want to send an email notification containing the following info when a commit occurs:

  • SVN User who comitted
  • Comment that the user entered
  • The name of the repo that was committed to
  • List of modified files
  • Transaction ID

Unfortunately the hooks only seem to provide some of this info. The post-commit hook provides the repo name and transaction ID only. The start-commit has the user and repo name, but not the transaction ID. And I can't find any hooks that provide the commit message or list of modified files.

Is there any way to make this information available to hooks? And if not, is there any other way to mail off this information on commit?


Solution

  • You can use svnlook command to get this information about revision: http://www.visualsvn.com/support/svnbook/ref/svnlook/

    Alternatively you can use VisualSVN Server built-in email notification command in VisualSVNServerHooks.exe. Just add following command to you post-commit hook:

    "%VISUALSVN_SERVER%\bin\VisualSVNServerHooks.exe" ^
         commit-notification "%1" -r %2 ^
         --from noreply@example.com --to svn-commits@example.com ^
         --smtp-server smtp.example.com
    

    You can find more information in KB18: http://www.visualsvn.com/support/topic/00018/