Announcement

Collapse
No announcement yet.

Sending Mail from SVN after committ

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

  • Sending Mail from SVN after committ

    Hi ,

    I need a help regarding the committ.
    We have a huge team and we use A
    Subversion client for Windows
    Version 1.6.10.

    we can monitor the committ with the help of Log But it is become very tidius to monitor for the entire team.

    So wanted to know that
    Is there any Facility or some other thing so that
    when a person from team committ the code in SVN, wil get an email to the Manager or who monitor entire activity.
    will get detail mail that
    B person has comitted the following part of code.

    Is this can be achive or there is any facility in the SVN?
    Please Help

    Thanks
    Om

  • #2
    You should read up on repository hook scripts and send an email from the post-commit hook. There should be plenty of Google hits if you search for such a thing.

    Comment


    • #3
      Hi,

      I had the same problem and solved it by using "wmailto"

      Basically, I created a batch file to copy wmailto.ini to the client (to avoid the manual copying for each user as this contains the exchange server mail info)
      Then the script exectues the command to send the email.
      Then I set up a hook on the users local to exectute this batch. Therefore, an email is sent to all receptians that I included every time there is a commit
      The only tadient thing is that you have to set-up the script for every user. Annoying if there is a big team

      Let me know if manage something that does not need such thing

      Comment


      • #4
        Originally posted by attardi View Post
        Hi,

        I had the same problem and solved it by using "wmailto"

        Basically, I created a batch file to copy wmailto.ini to the client (to avoid the manual copying for each user as this contains the exchange server mail info)
        Then the script exectues the command to send the email.
        Then I set up a hook on the users local to exectute this batch. Therefore, an email is sent to all receptians that I included every time there is a commit
        The only tadient thing is that you have to set-up the script for every user. Annoying if there is a big team

        Let me know if manage something that does not need such thing
        Or if you want to use something that was written in this century, sending email via PowerShell is literally a single line.
        Code:
        send-mailmessage -to $recipients -from $sender -subject "Subversion commit notification" -body "Developer B has committed the following items: " + $items -smtpserver mail.yourcompany.com
        I am neither an employee nor customer of WANDisco.

        Comment


        • #5
          Originally posted by attardi View Post
          Hi,

          I had the same problem and solved it by using "wmailto"

          Basically, I created a batch file to copy wmailto.ini to the client (to avoid the manual copying for each user as this contains the exchange server mail info)
          Then the script exectues the command to send the email.
          Then I set up a hook on the users local to exectute this batch. Therefore, an email is sent to all receptians that I included every time there is a commit
          The only tadient thing is that you have to set-up the script for every user. Annoying if there is a big team

          Let me know if manage something that does not need such thing
          As suggested in my previous post, you could use a repository hook script instead of a client hook script.

          Comment


          • #6
            Hi Mat
            Can you please elaborate more or your responce. The only hook I know of is to set from the local client (right click > TotrtoiseSVN > settings > hook script. Here, when you add a hook, the hook path says "Working copy path". So this should be on local station and therefore I need to set the hook on each user's PC.
            Is there a way that I make the hook on the repository, that is, when a commit is detected on the server repo, it sends the email??

            Comment


            • #7
              Ok I will answer my own question and make things clear:

              There are 2 types of hooks:
              1. Client hooks are the ones that are set through "right click > TortoiseSVN > settings > hook script". Here, you add a hook, to be executed for the "Working copy path".
              2. Repository hooks which are scripts that are placed in the /hooks folder of the created SVN repository

              Seems that for the repository hooks there is not much help for those who are NOT programmers or a step-by-step ‘dummy’ guide. A simple answer ‘look for.....’ won’t do the job. So seems that either you know programming, otherwise forget repository scripts, how to set them and execute them, etc.
              Hope I am wrong, if so, please give us some details from those who know about the matter.

              Comment


              • #8
                A repository hook script is simply a shell script (or batch file if your repository is hosted on a Windows box) that executes whatever commands you want. Look in your repository's hooks folder to see the templates provided. You might want to try reading the manual first ( http://svnbook.red-bean.com/en/1.7/s...n.create.hooks ) before coming back here with any more specific questions you have that are not answered there.

                Comment


                • #9
                  Originally posted by attardi View Post
                  Seems that for the repository hooks there is not much help for those who are NOT programmers or a step-by-step ‘dummy’ guide. A simple answer ‘look for.....’ won’t do the job. So seems that either you know programming, otherwise forget repository scripts, how to set them and execute them, etc.
                  Hope I am wrong, if so, please give us some details from those who know about the matter.
                  There are myriad example hook scripts on the internet if you run a simple Google search. Every repository comes with a full set of examples in the hooks directory as well.

                  As for creating a hook script, it's a matter of working out:
                  • What do I need to accomplish?
                  • How do I get the data needed to make my decisions or send notifications? (typically svnlook, for server-side hooks)
                  • What are my rules (logic)?
                  The rest is down to the syntax of the language you've chosen for implementation.

                  As a server administrator (Subversion or otherwise), if you don't know & embrace scripting of any sort, you're doomed to a lifetime of drudgery & pain while you repetitively do the same chores over and over again. It's not full application programming, but knowledge of automation (scripting) is one of the most valuable skills an administrator can posses.
                  I am neither an employee nor customer of WANDisco.

                  Comment


                  • #10
                    Originally posted by mbooth View Post
                    A repository hook script is simply a shell script (or batch file if your repository is hosted on a Windows box)
                    Unless something's changed recently, a hook on Windows can also be a .COM (do those even exist anymore?) or .EXE file (written in any language).

                    Windows batch files really suck, but they can be used to kick off WSH scripts which suck a lot less, or PowerShell scripts which don't really suck at all (OK, WSH isn't really that bad, especially if you use JScript - but it doesn't hold a candle to PowerShell). Just pass the parameters through.
                    I am neither an employee nor customer of WANDisco.

                    Comment


                    • #11
                      Originally posted by andyl View Post
                      Unless something's changed recently, a hook on Windows can also be a .COM (do those even exist anymore?) or .EXE file (written in any language).
                      Thanks for the correction -- I am not a Windows user!

                      Comment

                      Working...
                      X