Sending Subversion Commit Information by Email


On each commit, I want to send email with the commit details to a list of emails.
This is necessary to keep everyone involved updated. We are using subversion version
control system on windows, we use cygwin extensively to automate frequent tasks.
Here are the steps to do so:

Environment:
– Windows XP Service Pack 2
– Cygwin DLL release version is 1.5.23-2
– email version 2.5.0
– subversion 1.0.6

Sending email:
– The email.exe tool is a nice small tool to send email using sendmail or using other
SMTP server, I use it to send through our company SMTP server.
– First install cygwin, and you must select additional email tool from the email group.
After installation you will have a shortcut on your Desktop.

After download and installation are OK, you need to configure the email tool before using it.
>From now on, I will put $ before each command line, simply this is the bash prompt. You get bash prompt
by running cygwin shortcut on your PC Desktop.

$ email-config
You will be prompted with a series of questions, answer it to setup the email configuration file.

Please enter your From: name (e.g., John Doe) [Your Real Name]:
Please enter your From: email address [yourlogin@example.com]:
Please enter your Reply-to: email address []:
Enter 1 to use sendmail or 2 to use a SMTP server [1]:
Please enter the address of your SMTP server [127.0.0.1]:
Please enter the SMTP port number [25]:
Please select SMTP authentication (1 for none, 2 for LOGIN, 3 for PLAIN) [1]:
Please enter your SMTP username []:
Please enter your SMTP password []:

$

You can look at /etc/email/email.conf to review your selections and update them as needed.

You can have a look at email man pages by typing, it will show you all the switched used by email tool.
$man email

you can test by sending email to yourself:
$echo “This is a test email body message” > email.txt
$email -s “subject test 1” me@mycompany.com < email.txt

– The first line create file email.txt with the string “This is a test email body message”, of course you can use your favorite editor.
– The second line will just send the email taking the email body from the input stream through “<email.txt”

Now we need to catch svn commit to generate helpful message about the commit and send to email list.

Edit the file c:svnreposmyprojecthookpost-commit.bat using your favorite editor, I assume you locate your repository on c:svnreposmyproject

Add the following lines to it:

SET PATH=%PATH%;c:cygwinbin;C:subversionbin;
svn log -v -r “%1” svn://rd-cdma1/myproject > email.txt
svnlook diff “c:svnreposmyproject” -r “%1” >> email.txt
email -s “Subversion – %2 – %1” email1@company.com,email2@company.com < email.txt

– The PATH environement variable must be set to your programms pathes, I assume c:cygwinbin;C:subversionbin; You must use the correct values that match your system.
– The post-commit.bat will be called every time someone committed new code, this is per subversion implementation.
– %1 is the repository name, automatically passed to the post-commit.bat from subversion.
– %2 is the revision number, automatically passed to the post-commit.bat from subversion.
– > is the redirection operator used to create and append the output to a file.
– >> is the redirection operator used to append at the end of file.
– We use hard coded repository path and URL as the passed parameter %1 has backslashes which doesn’t work on Windows.

Conclusion:
Using command line tools is very helpful in automating tasks, many of the tasks done by admins requires automation, although GUI is very easy to use at first, you will continue doing things manually. command line give you powerful ways to automate new tasks without developing code which takes much more time.

Resources:
– Get cygwin from http://www.cygwin.com/
– Get subversion from http://subversion.tigris.org/

From ahm507.blogspot.com

0 responses to “Sending Subversion Commit Information by Email”

  1. I executed the steps of sending the email when commit and the email was sent successuflly when commited but the commit details not sent.

  2. Adjust the path of repository and run the following one line command:
    svnlook diff "c:svnreposmyproject" -r "%1" >> email.txt

    Ensure the file email.txt contains your commit details.

  3. $ email -s "Hello" mhossam@sewedy.net.eg < email.txt
    email:FATAL : Could not connect to server:192.168.50.3 on port :25:connection refused
    caught an ERROR,Shutting down …
    – The previous is the message that appeared when I tested the email after executes the steps of sending the email, Can you help me to be able to successfully send the email through the network.

  4. [url=http://firgonbares.net/][img]http://firgonbares.net/img-add/euro2.jpg[/img][/url]
    [b]which software to buy, [url=http://firgonbares.net/]price h software[/url]
    [url=http://firgonbares.net/][/url] free autocad drawing downloads macromedia dreamweaver software
    shop by software [url=http://firgonbares.net/]adobe software cheap[/url] office 2003 activation bypass
    [url=http://firgonbares.net/]to sell software services[/url] filemaker pro expert
    [url=http://firgonbares.net/]adobe photoshop cs3 cracked[/url] buy new software
    adobe photoshop cs3 classroom in a book [url=http://firgonbares.net/]academic software licence[/b]

  5. [url=http://murudobaros.net/][img]http://murudobaros.net/img-add/euro2.jpg[/img][/url]
    [b]nero 9 and windows 7, [url=http://murudobaros.net/]filemaker pro 10 advanced[/url]
    [url=http://murudobaros.net/]price camera software[/url] adobe software discounts discounted software for non
    adobe photoshop cs3 8.0 phone activation [url=http://murudobaros.net/]software to sell[/url] electronic purchase order software
    [url=http://murudobaros.net/]buy windows software online[/url] nero emperor of rome
    [url=http://murudobaros.net/]office 2003 vista[/url] free download 3d landscape model in autocad
    g1 software store [url=http://murudobaros.net/]software sales agent[/b]

  6. [color=#225588]Музыкальная группа [url=http://dejavu-group.ru/artist.php]Deja Vu[/url] – это коллектив виртуозных вокалистов и музыкантов.
    [url=http://dejavu-group.ru/index.php]Deja Vu[/url]- законодатель в области музыкального сопровождения торжеств, музыкальных мероприятий, корпоративок .
    В копилке ВИА Deja Vu более 3000 произведений.
    Живая музыка. Поп, хиты 70-80-90-х, диско, джаз, ретро, современная музыка, европейские хиты, фоновая музыка, шансон .
    Группа Дежа вю обладает мощной качественной музыкальной аппаратурой, позволяющей наполнить приятным и плотным уху звуком как компактное помещение (фуршет), так и огромное помещение (корпоратив до 1000 человек).

    Андрей +7 910 483 8294 [/color]

  7. [color=#225588]Музыканты на праздник [url=http://dejavu-group.ru/about_us.php]Deja Vu[/url] – это коллектив дипломированных вокалистов и музыкантов на праздник.
    [url=http://dejavu-group.ru/index.php]Deja Vu[/url]- лидер в области проведения и организации музыкальных мероприятий, свадеб, юбилеев.
    В копилке музыкантов на праздник Deja Vu более 3000 песен.
    Живая музыка. Диско, хиты 70-80-90-х, джаз, ретро, шансон, современная музыка, европейские хиты, фоновая музыка, поп .
    Музыканты на праздник Deja Vu располагает мощной качественной аппаратурой, позволяющей наполнить приятным и плотным уху звуком как небольшое помещение (фуршет), так и большое пространство (корпоратив до 1 тыс. человек).

    Игорь +7 916 623 4047 [/color]

  8. Emergency Funds through Your Phone. Do you urgently need to borrow money for an emergency situation Find out where.

  9. The author of ahm507.blogspot.com has written an excellent article. You have made your point and there is not much to argue about. It is like the following universal truth that you can not argue with: Blind compliance or compulsive non-compliance of anything are like the two sides of the same coin due to ignorance. Thanks for the info.

  10. [color=#225588]
    Как дела? И кстати.. есть мега мысль по[url=http://www.pi7.ru] видео[/url] порталу Думаю вам понравится

    [url=http://www.pary.ws/sc.html]Мальчик в первый раз трахает тётю[/url]
    aнекдот для разнообразия 🙂

    Парень склоняет девушку к близости:
    – До свадьбы нельзя…
    – Ничего, до свадьбы заживет

    Я 7 часов блуждала по сети, пока не вышела на ваш форум! Думаю, я здесь останусь надолго!
    прошу прощения аз оечатки….. очень маленькя клавиатура у PDA!

    [/color]

  11. [color=#225588]
    Не знаеш который час в этом городе? Может-быть… есть мега мысль по[url=http://www.pi7.ru] видео[/url] порталу Думаю вам понравится

    [url=http://www.pi7.ru]инструкция для фольги для выпекания [/url]
    aнекдот для разнообразия 🙂

    Парень склоняет едвушку к близости:
    – До свадьбы нельзя….
    – Ничего, до ссадьбы заживет

    Я 5 часов блуждала по сети, пока не вышела на авш форум! Думаю, я здесь останусь надолго!
    прошу прощения за опечатки…. очень маленькая клавиатура у PDA!

    [/color]

Leave a Reply

Your email address will not be published. Required fields are marked *