<?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>Brian Wigginton &#187; Subversion</title>
	<atom:link href="http://www.bwigg.com/category/subversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bwigg.com</link>
	<description>Lab and Nerdery</description>
	<lastBuildDate>Fri, 03 Feb 2012 04:15:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Subversion: Continuous Integration with a PHP Application</title>
		<link>http://www.bwigg.com/2009/10/subversion-continuous-integration-with-a-php-application/</link>
		<comments>http://www.bwigg.com/2009/10/subversion-continuous-integration-with-a-php-application/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 21:13:32 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=110</guid>
		<description><![CDATA[Abstract This tutorial explains how to update a staging site whenever there is a commit to the SVN repository. This assumes basic knowledge of Subversion, Apache and C and that the staging site is running a working copy checked out from the repository. Problem &#38; Solution When working close with designers or other non-coders it's [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Abstract</strong></p>
<p>This tutorial explains how to update a staging site whenever there is a commit to the SVN repository. This assumes basic knowledge of Subversion, Apache and C and that the staging site is running a working copy checked out from the repository.</p>
<p><strong>Problem &amp; Solution<br />
</strong></p>
<p>When working close with designers or other non-coders it's often most productive to be able to make quick changes live to the box serving up the dev site, then to commit a change then update the server over and over. The bigger issue is that there is now modified code on the dev site that's not revisioned with subversion. To solve this problem we are going to update the codebase for the development site whenever anyone commits changes to the subversion repository.</p>
<p><strong>update_svn</strong></p>
<p>update_svn is a C program that will make a call to the svn command with our designated username and password and update the working copy. This program should live inside your applications directory.</p>
<p><em>update.c</em></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#include &lt;stddef.h&gt;</span>
<span style="color:#008000; font-style:italic;">#include &lt;stdlib.h&gt;</span>
<span style="color:#008000; font-style:italic;">#include &lt;unistd.h&gt;</span>
int main<span style="color:#006600; font-weight:bold;">&#40;</span>void<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#006600; font-weight:bold;">&#123;</span>
     execl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;/usr/bin/svn&quot;</span>, <span style="color:#996600;">&quot;svn&quot;</span>, <span style="color:#996600;">&quot;update&quot;</span>, <span style="color:#996600;">&quot;--username&quot;</span>,
     <span style="color:#996600;">&quot;USERNAME&quot;</span>, <span style="color:#996600;">&quot;--password&quot;</span>, <span style="color:#996600;">&quot;PASSWORD&quot;</span>,
     <span style="color:#996600;">&quot;/var/www/website/&quot;</span>,  <span style="color:#006600; font-weight:bold;">&#40;</span>const char <span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span> NULL<span style="color:#006600; font-weight:bold;">&#41;</span>;
     <span style="color:#0000FF; font-weight:bold;">return</span><span style="color:#006600; font-weight:bold;">&#40;</span>EXIT_FAILURE<span style="color:#006600; font-weight:bold;">&#41;</span>;
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>Compile and add permissions</p>
<p><code>gcc svn_update.c -o /var/www/website/update_svn<br />
chmod +s update_svn</code></p>
<p><strong>Subversion post-commit hook</strong></p>
<p>In our subversion repository's post-commit script we want to add a call to update_svn. Add the following line to your post-commit script:</p>
<p><code>/var/www/website/update_svn</code></p>
<p>Resources:</p>
<ul>
<li><a title="SVN Post Commit script to update php code" href="http://dtbaker.com.au/random-bits/svn-post-commit-script-to-update-php-code.html">David Baker: SVN Post Commit script to update php code</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2009/10/subversion-continuous-integration-with-a-php-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion: Repository on Subdomain</title>
		<link>http://www.bwigg.com/2009/10/subversion-repository-on-subdomain/</link>
		<comments>http://www.bwigg.com/2009/10/subversion-repository-on-subdomain/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 18:54:00 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=93</guid>
		<description><![CDATA[Tutorial explaining how to setup a Subversion repository on a subdomain using Apache2.]]></description>
			<content:encoded><![CDATA[<p>This is a tutorial on how to setup a Subversion repository on a subdomain with Apache. This assumes you have Subversion and Apache already installed on your system.</p>
<p><strong>Subversion Setup</strong></p>
<p>First you need to create a repository somewhere in your file system. Then grant apache permissions on that directory.</p>
<p><code>svnadmin create /var/svn/repository<br />
sudo chown -R www-data:www-data /var/svn/repository</code></p>
<p><strong>Controlling Access</strong></p>
<p>Access to the repo via the web will be controlled by an htpasswd file located at /<code>var/svn/svn-auth-file</code>. Use the <code>htpasswd</code> command to create the file.</p>
<p><code>htpasswd -c /var/svn/svn-auth-file &lt;username&gt;</code></p>
<p>Execute the script again without the -c argument to add more people to the list.</p>
<p><code>htpasswd /var/svn/svn-auth-file &lt;username_two&gt;</code></p>
<p><strong>Apache Setup</strong></p>
<p>I usually setup Apache to use Names VirtualHosts to handle multiple websites. We'll make a new named virtualhost for subversion repository.</p>
<p><code>&lt;VirtualHost *:80&gt;<br />
ServerName svn.your_domain.com<br />
&lt;location /&gt;<br />
DAV svn<br />
SVNPath /var/svn/repository</code></p>
<p><code> AuthType Basic<br />
AuthName "Subversion repository"<br />
AuthUserFile /var/svn/svn-auth-file<br />
Require valid-user<br />
&lt;/location&gt;<br />
&lt;/VirtualHost&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2009/10/subversion-repository-on-subdomain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion: Commit Emails</title>
		<link>http://www.bwigg.com/2009/10/subversion-commit-emails/</link>
		<comments>http://www.bwigg.com/2009/10/subversion-commit-emails/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 16:29:46 +0000</pubDate>
		<dc:creator>bawigga</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://www.bwigg.com/?p=89</guid>
		<description><![CDATA[This is a tutorial on how to setup Subversion to email a team when there is a commit to the repository. Subversion Hooks Hooks are what Subversion executes upon certain events. Within your SVN directory you should see the following items README.txt conf dav db format hooks locks Go into the hooks directory and you [...]]]></description>
			<content:encoded><![CDATA[<p>This is a tutorial on how to setup Subversion to email a team when there is a commit to the repository.</p>
<p><strong>Subversion Hooks</strong></p>
<p>Hooks are what Subversion executes upon certain events. Within your SVN directory you should see the following items</p>
<ul>
<li>README.txt</li>
<li>conf</li>
<li>dav</li>
<li>db</li>
<li>format</li>
<li><strong>hooks</strong></li>
<li>locks</li>
</ul>
<p>Go into the hooks directory and you will see a bunch of files ending in .tmpl. These are template scripts that are prebaked for you. Within each hook file are calls to scripts you want to be executed. To get one to execute you need to remove the .tmpl extension and then make it executable.</p>
<p><code>mv post-commit.tmpl post-commit<br />
chmod +x post-commit</code></p>
<p><strong>The Post Commit Hook &amp; commit-email.pl</strong></p>
<p>In post-commit there is a call to <code>commit-email.pl</code>. (Be sure that this calls to the absolute path of the script)</p>
<p>I didn't have <code>commit-email.pl</code> on my server but acquired it from the Subversion Tools Repository <a title="Subversion commit-email.pl" href="http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/commit-email.pl.in" target="_blank">here</a>.Save that file to your hooks directory. Also, be sure to edit that file and rename all the <code>@SVN_BINDIR@</code> instances to the directory of you subversion executable. To find out type <code>which svn</code> and use the path that returns. Mine returned <code>/usr/bin/svn</code> to I used <code>/usr/bin/</code> for @SVN_BINDIR@.</p>
<p>Run commit-email.pl without any arguments to see a list of options. To test this script point it to a repository and a revision number.</p>
<p><code>./commit-email.pl /var/svn/repository 1 --from "Subversion Gate Keeper &lt;subversion@example.com&gt;" youremail@example.com anotheremail@example.com</code></p>
<p>I like to prepend a subject line prefix so I can filter it a little easier when it comes through to my email client. Adding the <code>-s</code> argument to the command will allow you to specify a subject line prefix.</p>
<p><code>./commit-email.pl /var/svn/repository 1 --from "Subversion Gate Keeper &lt;subversion@example.com&gt;" -s "Commit Activity: " youremail@example.com anotheremail@example.com</code></p>
<p>Here are some more resources to help you out.</p>
<ul>
<li><a title="Subversion Tools" href="http://subversion.tigris.org/tools_contrib.html" target="_blank">Subversion Tools</a></li>
<li><a title="Pete Freitag: Using Subversion Hooks to send out build emails" href="http://www.petefreitag.com/item/244.cfm" target="_blank">Pete Freitag: Using Subversion Hooks to send out build emails</a></li>
</ul>
<p><strong>Edit - October, 27:</strong> You have to call your scripts within post-commit by their absolute path or else they wont run. Code above has been modified.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bwigg.com/2009/10/subversion-commit-emails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

