<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Discussion Delegate &#187; opensource</title>
	<atom:link href="http://vxtindia.com/blog/tag/opensource/feed/" rel="self" type="application/rss+xml" />
	<link>http://vxtindia.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 23 Jul 2010 08:53:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Get emails from SVN on commit</title>
		<link>http://vxtindia.com/blog/get-emails-from-svn-on-commit/</link>
		<comments>http://vxtindia.com/blog/get-emails-from-svn-on-commit/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 09:44:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[post-commit]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.vxtindia.com/?p=71</guid>
		<description><![CDATA[We have been using SVN for a couple of years for all of our projects. Initially we were hosting them at Springloops.com for almost a year, when we decided to start hosting them on our own server.
It all sounded really good, till we realized that code reviews became a real problem. Springloops had a stunning [...]]]></description>
			<content:encoded><![CDATA[<p>We have been using <strong>SVN</strong> for a couple of years for all of our projects. Initially we were hosting them at <a rel="nofollow" href="http://springloops.com">Springloops.com</a> for almost a year, when we decided to start hosting them on our own server.</p>
<p>It all sounded really good, till we realized that code reviews became a real problem. Springloops had a <em>stunning</em> interface to compare the <em>diffs</em> and get all the related information, which we really missed.</p>
<p>So we decided to use the <strong>post-commit hooks</strong> in SVN to email us as soon as a commit was made.</p>
<p>If you would like to implement the same for your server, here is a quick and dirty guide on how to do that.</p>
<p>First, the details about our server</p>
<p><code># svn --version<br />
svn, version 1.5.1 (r32289)<br />
compiled Jul 31 2008, 09:45:20<br />
</code></p>
<p><code># lsb_release -a<br />
No LSB modules are available.<br />
Distributor ID: Ubuntu<br />
Description:    Ubuntu 8.10<br />
Release:        8.10<br />
Codename:       intrepid<br />
</code></p>
<p><em>Okay</em>, so let us get started. The first thing that you should know is that inside your repository, SVN creates a folder called <em>hooks</em>. This folder initially contains template files for all the hooks that can be called via SVN. The hook that we are after today, is called <strong>post-commit.tmpl</strong></p>
<p>Since our language of preference is <em>PHP</em>, we decided to call a php script as soon as a commit was done on that repository. Here is how we did it</p>
<p><code># cd /path/to/repo/hooks<br />
# mv post-commit.tmpl post-commit<br />
# chmod 755 post-commit<br />
# vi post-commit<br />
</code></p>
<p>The post-commit file contains the following</p>
<p><code>#!/bin/sh<br />
<br />
REPOS="$1"<br />
REV="$2"<br />
<br />
php /svn/scripts/postCommitHook.php $REPOS $REV<br />
</code></p>
<p>The above steps can also be <strong>automated</strong> by writing another php script which would copy all our hooks from a base directory into the respective directories in the repositories. <em>Here is what our script looks like</em></p>
<p><script src="http://gist.github.com/390643.js"></script></p>
<p>Finally, we need to create the file <strong>postCommitHook.php</strong> which will find out all the relevant information and mail you the details. We have used <em>svnlook </em>and <em>phpmailer </em>to get all the information. Here is what our postCommitHook.php looks like</p>
<p><script src="http://gist.github.com/390645.js"></script></p>
<p><em>And that is it!</em></p>
<p>Once the scripts are in place, just run copyHooks.php once and then whenever anybody commits on any of your repositories, you will get an elaborate email with the diff.</p>
<img src="http://vxtindia.com/blog/?ak_action=api_record_view&id=71&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://vxtindia.com/blog/get-emails-from-svn-on-commit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/


Served from: vxtindia @ 2010-09-10 18:54:32 -->