Announcement

Collapse
No announcement yet.

Help needed with a Windows SVN hook which looks for a certain word in the comment?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help needed with a Windows SVN hook which looks for a certain word in the comment?

    I am trying to implement a pre-commit subversion hook which looks for a pattern in the commit comment? Any pointers on how to do this? Like whenever someone tries to check in a file, I want to look for the word 'ABCD' in the comment they have entered along with forcing them to enter a comment. I have searched everywhere but simply couldn't find a hook that does the above. Any help will be greatly appreciated.

  • #2
    Hi there,

    This should work for you - though you'll need to make sure you put in the correct path to svnlook.exe in the quotes and change 'ABCD' to the actual string you require to be in there:

    Code:
    "C:\Program Files\WANdisco\Subversion\svnlook.exe" log -t %2 %1 | FindStr ABCD
    IF %ERRORLEVEL% EQU 0 GOTO OK
    echo "Commit message must contain ABCD" >&2
    exit 1
    :OK
    exit 0
    Hope that helps.

    Comment


    • #3
      Thanks a ton for your help orbrey. Much appreciated.

      Comment


      • #4
        Sorry, a quick question..Whats the svnlook.exe path pointing to?
        I can only see this path on my computer
        C:\Program Files\TortoiseSVN

        Comment


        • #5
          That'd be the one - if you look in that folder you should see svnlook.exe in there

          EDIT: Apologies, the path I quoted above is taken from my command line Subversion install. If you look in the bin folder in the TortoiseSVN folder you posted above you should find svnlook.exe in there.
          Last edited by orbrey; 10-10-2014, 03:48 PM.

          Comment


          • #6
            That list command gives an error when the directory does not exist. That only works if the directory already exist. How do I handle the error when the directory does not exist ?




            Comment


            • #7
              Great information, i read your all post. Thanks

              Rechly Parker
              IT Analyst
              SageNext Infotech LLC

              Comment

              Working...
              X