

<?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>ShareDigest blog &#187; subversion</title>
	<atom:link href="http://blog.sharedigest.com/tag/subversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sharedigest.com</link>
	<description>Trading, software, web and random stuff</description>
	<lastBuildDate>Tue, 06 Jul 2010 11:30:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Handy Subversion Commands</title>
		<link>http://blog.sharedigest.com/handy-subversion-commands/</link>
		<comments>http://blog.sharedigest.com/handy-subversion-commands/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 05:53:46 +0000</pubDate>
		<dc:creator>SD</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[handy subversion commands]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn commands]]></category>
		<category><![CDATA[useful subversion]]></category>

		<guid isPermaLink="false">http://blog.sharedigest.com/?p=102</guid>
		<description><![CDATA[Create And Import Into a New Subversion (SVN) Repository:
Replace &#8216;$repos_name&#8217; with the name of your SVN repository &#8211; typically the name of the project folder.
(Note: For further repository admin functions and general SVN admin, see here).

$ svnadmin create /var/svn/$repos_name
&#160;
#Note: To remove a repository, simply delete the directory directly as root user: (don't do this now [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Create And Import Into a New Subversion (SVN) Repository:</strong><br />
Replace &#8216;$repos_name&#8217; with the name of your SVN repository &#8211; typically the name of the project folder.<br />
(Note: For further repository admin functions and general SVN admin, see <a href="http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.reposadmin" target="_blank">here</a>).</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ svnadmin create /var/svn/$repos_name
&nbsp;
#Note: To remove a repository, simply delete the directory directly as root user: (don't do this now unless you want to remove it :-):
sudo rm -R /var/svn/$repos_name</pre></div></div>

<div align="center"><script type="text/javascript"><!--
google_ad_client = "pub-1739519678603459";
/* SDblog_300_250, created 9/24/09 */
google_ad_slot = "6287581496";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>The recommended organization for a repository is to use the folders trunk, branches and tags, which we create using:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ svn mkdir file:///var/svn/$repos_name/trunk
$ svn mkdir file:///var/svn/$repos_name/branches
$ svn mkdir file:///var/svn/$repos_name/tags</pre></div></div>

<p>Now let&#8217;s import our project folder to this repository&#8217;s &#8216;trunk&#8217; (main development line) folder): We do this the FIRST TIME we want to start tracking a project in the repository.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ svn import localProjFolder file:///var/svn/$repos_name/trunk</pre></div></div>

<p><strong>Checking Out a Folder From a Repository:</strong></p>
<p>Before having a local &#8216;working copy&#8217; we need to check out the project folder for the first time:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ svn checkout file:///var/svn/$repos_name/trunk {optional: localProjFolder}</pre></div></div>

<p>Now we have a local working copy our project. We can make whatever changes we like, as in a usual file system structure. Note that any changes, APART FROM A STRAIGHT MODIFICATION TO A FILE (using a text editor for example), needs to be preceded by an &#8217;svn&#8217; to the command. For example, &#8217;svn mkdir&#8217; needs to be run to add a directory to the project. This is because SVN needs to be made aware of these changes.</p>
<p><strong>Editing A File</strong></p>
<p>Let&#8217;s say I have edited the file SecNew. java. We can now check the status of scheduled changes to our folder by running:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ svn status
M      SecNew.java</pre></div></div>

<p>In the above, we can see that the file SecNew.java was modified (in the working copy), and is due for modification in the repository.</p>
<p><strong>Add A Folder To Our SVN Project</strong></p>
<p>Let&#8217;s now add a folder to our project. I am going to add &#8216;custom&#8217; to the folder SDCommon/src/org/:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ svn mkdir ~/workspace/SDCommon/src/org/custom
A      custom</pre></div></div>

<p>Note how I used &#8217;svn&#8217; before the usual &#8216;mkdir&#8217; command. Remember, only pure editing of files does NOT require this preceding &#8217;svn&#8217; to be used.<br />
The last line shows us that the folder was successfully created and is scheduled to be (A)dded to the repositoy.</p>
<p><strong>Seeing What Changes We&#8217;ve Made To Our Folder: svn status &amp; svn diff</strong></p>
<p>Simply run the &#8217;svn status&#8217; command:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ svn status
M      SecNew.java
A      custom</pre></div></div>

<p>We can see the changes that are scheduled to be made to the repository on a commit.</p>
<p>Let&#8217;s now check out what specific changes have occurred to files that have been modified (SecNew.java in this case):</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">pacific@mainbox:~/workspace/SDCommon/src/org$ svn diff
&nbsp;
Index: SecNew.java
===================================================================
--- SecNew.java (revision 6)
+++ SecNew.java (working copy)
@@ -5,6 +5,8 @@
 import org.apache.log4j.Logger;
&nbsp;
 public class Security { //can be overridden if need be
+       protected DateTime StartDate = null;
+
        protected String ticker = null;
        protected String exchcode = null; //yahoo ec
        protected String name = null;</pre></div></div>

<p>Lines that have a &#8216;+&#8217; next to them, have been added. (a &#8216;-&#8217; indicates lines that have been removed).</p>
<div align="center"><script type="text/javascript"><!--
google_ad_client = "pub-1739519678603459";
/* SDblog_300_250, created 9/24/09 */
google_ad_slot = "6287581496";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.sharedigest.com/handy-linux-commands/" rel="bookmark">Handy Linux Commands</a></li><li><a href="http://blog.sharedigest.com/subversion-using-apache-and-ssl/" rel="bookmark">Subversion Using Apache And SSL</a></li><li><a href="http://blog.sharedigest.com/linux-shell-scripting-check-if-folder-exists/" rel="bookmark">Linux Shell Scripting: Check if Folder Exists</a></li><li><a href="http://blog.sharedigest.com/cron-task-for-automated-backups/" rel="bookmark">Cron Task For Automated Backups</a></li><li><a href="http://blog.sharedigest.com/optimizing-mysql-1-using-indexes/" rel="bookmark">Optimizing MySQL 1: Using Indexes</a></li></ul></div><hr /><h2>Related posts:</h2><ul><li><a href="http://blog.sharedigest.com/handy-linux-commands/" rel="bookmark" title="Permanent Link: Handy Linux Commands">Handy Linux Commands</a></li><li><a href="http://blog.sharedigest.com/subversion-using-apache-and-ssl/" rel="bookmark" title="Permanent Link: Subversion Using Apache And SSL">Subversion Using Apache And SSL</a></li></ul><hr /><small>Copyright &copy; 2008<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small>]]></content:encoded>
			<wfw:commentRss>http://blog.sharedigest.com/handy-subversion-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion Using Apache And SSL</title>
		<link>http://blog.sharedigest.com/subversion-using-apache-and-ssl/</link>
		<comments>http://blog.sharedigest.com/subversion-using-apache-and-ssl/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 07:41:21 +0000</pubDate>
		<dc:creator>SD</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://blog.sharedigest.com/?p=90</guid>
		<description><![CDATA[So you&#8217;d like to host a SVN repository which allows fine-grained access control and different users and projects? Look no further, as we&#8217;ll be covering how to achieve just that in this post. What we&#8217;ll be using is the Apache Web server (with SSL encryption), SubVersion and Trac which is a web-based software management package. [...]]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;d like to host a SVN repository which allows fine-grained access control and different users and projects? Look no further, as we&#8217;ll be covering how to achieve just that in this post. What we&#8217;ll be using is the Apache Web server (with SSL encryption), SubVersion and Trac which is a web-based software management package.  I&#8217;ll be doing this on my Kubuntu Hardy Heron (Linux debian) machine, so if you&#8217;re installing it under a different version / OS instructions may vary slightly.</p>
<p><em>Note: You will need sudo access rights and a basic text editor (such as Kate) to do these.</em></p>
<div align="center"><!--adsense#SDblog_300_250--></div>
<p><strong>Step 1: Install Apache httpd</strong></p>
<p>This is as simple as installing the &#8216;apache2&#8242; package using apt-get or aptitude:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo aptitude install apache2</pre></div></div>

<p>For further detail on the installation of the Apache web server, see <a href="https://help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html" target="_blank">this</a>.</p>
<p><strong>Step 2: Install Subversion &amp; Apache SVN Libraries</strong><br />
Similar to step 1, to install the subversion and the svn libraries for apache, simply run:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo aptitude install subversion libapache2-svn</pre></div></div>

<p><strong>Step 3: Enable SSL</strong><br />
First we enable the Apache ssl module, followed by adding &#8216;Listen 443&#8242; to the Apache2 port configuration file (see below):</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo a2enmod ssl
$ sudo kate /etc/apache2/ports.conf</pre></div></div>

<p>After opening the ports.conf file, make sure that the following is in the file:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;IfModule mod_ssl.c&gt;
        Listen 443
&lt;/IfModule&gt;</pre></div></div>

<p><strong>Step 4: Generate SSL Certificate</strong><br />
Once we have enabled the SSL module, we need to generate a certificate to use:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">#create dir where ssl certificates will go:
$ sudo mkdir /etc/apache2/ssl  
&nbsp;
#create certificate (should launch application asking some basic questions)
$ sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem</pre></div></div>

<p><strong>Step 5: Create a Virtual Host </strong></p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">#copy default folder to svnserver folder
$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/svnserver
&nbsp;
#Open svnserver:
$ sudo kate /etc/apache2/sites-available/svnserver</pre></div></div>

<p>Now, within the svnserver file, change the following:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&quot;NameVirtualHost *&quot; to &quot;NameVirtualHost *:443&quot;
&quot;&lt;VirtualHost *&gt;&quot;  to  &lt;VirtualHost *:443&gt;&quot;</pre></div></div>

<p>Directly under &#8216;ServerAdmin&#8217;, add the following:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM</pre></div></div>

<div align="center"><!--adsense#SDblog_300_250--></div>
<p><strong>Step 6: Enable The Site</strong></p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo a2ensite svnserver
$ sudo /etc/init.d/apache2 restart
#To avoid warnings when restarting apache2, add &quot;ServerName $your_server_name&quot; to /etc/apache2/apache2.conf</pre></div></div>

<p><strong>Step 7: Add Repositories</strong><br />
To host more than one repository, use the following configurations, replacing $REPOS with the name of your repository-folder, for example I&#8217;ve used &#8217;svn-repos&#8217;</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo mkdir /var/svn
$ sudo svnadmin create /var/svn/$REPOS
$ sudo chown -R www-data:www-data /var/svn/$REPOS
$ sudo chmod -R g+ws /var/svn/$REPOS</pre></div></div>

<p><strong>Step 8: Add Authenticated User</strong><br />
Add a user using the following, substituting $username with your selected username. You&#8217;ll be prompted for a password.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo htpasswd -c -m /etc/apache2/dav_svn.passwd $username</pre></div></div>

<p><strong>Step 9: WebDAV and SVN Configuration</strong><br />
Open the file: /etc/apache2/mods-available/dav_svn.conf using Kate, and either enable (uncomment) or add the following:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;Location /svn&gt;
DAV svn
SVNParentPath /var/svn/
AuthType Basic
AuthName &quot;Subversion Repository&quot;
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
SSLRequireSSL
&lt;/Location&gt;</pre></div></div>

<p>Now restart the Apache2 webserver one final time:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">$ sudo /etc/init.d/apache2 restart</pre></div></div>

<p><strong>Step 10: Test It !</strong><br />
Point your browser to: https://localhost/svn/$REPOS   (where $REPOS is your specific svn repository)<br />
You should now see something like &#8220;Revision 0: /&#8221; appear &#8211; this is our first SVN repository contents. Obviously it is empty, so let&#8217;s get right stuck into<br />
testing it out with some SVN!</p>
<div align="center"><!--adsense#SDblog_300_250--></div>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.sharedigest.com/handy-subversion-commands/" rel="bookmark">Handy Subversion Commands</a></li><li><a href="http://blog.sharedigest.com/linux-shell-scripting-check-if-folder-exists/" rel="bookmark">Linux Shell Scripting: Check if Folder Exists</a></li><li><a href="http://blog.sharedigest.com/cron-task-for-automated-backups/" rel="bookmark">Cron Task For Automated Backups</a></li><li><a href="http://blog.sharedigest.com/handy-linux-commands/" rel="bookmark">Handy Linux Commands</a></li><li><a href="http://blog.sharedigest.com/australian-market-news-monday-march-8/" rel="bookmark">Monday, March 8</a></li></ul></div><hr /><h2>Related posts:</h2><ul><li><a href="http://blog.sharedigest.com/handy-subversion-commands/" rel="bookmark" title="Permanent Link: Handy Subversion Commands">Handy Subversion Commands</a></li></ul><hr /><small>Copyright &copy; 2008<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small>]]></content:encoded>
			<wfw:commentRss>http://blog.sharedigest.com/subversion-using-apache-and-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

