<?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>Thijs Lensselink&#039;s Blog &#187; SVN</title>
	<atom:link href="http://lenss.nl/tag/svn/feed/" rel="self" type="application/rss+xml" />
	<link>http://lenss.nl</link>
	<description>Webdevelopment and stuff...</description>
	<lastBuildDate>Sun, 05 Feb 2012 11:39:43 +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>Moving from Subversion to GIT</title>
		<link>http://lenss.nl/2010/11/moving-from-subversion-to-git/</link>
		<comments>http://lenss.nl/2010/11/moving-from-subversion-to-git/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 20:12:50 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[/home]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[GIT]]></category>
		<category><![CDATA[PFZ]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=941</guid>
		<description><![CDATA[Last weekend was a PFZ meeting. And for this day a few interesting workshops were planned. I mainly was looking forward to the GIT (Git for Subversion Users) talk by Stefan Koopmanschap. And the Dependency Injection presentation by Berry Langerak I didn&#8217;t make it too the last one. But learned a lot while doing the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://git-scm.com/" target="_blank"><img src="http://lenss.nl/wp-content/uploads/2010/11/git.logo_.gif" alt="" style="float:left;" title="git.logo_" width="141" height="55" class="aligncenter size-full wp-image-965" /></a> Last weekend was a <a href="http://pfz.nl">PFZ</a> meeting. And for this day a few interesting <a href="http://www.pfz.nl/activiteit/1-workshopdag-2010/">workshops</a> were planned. I mainly was looking forward to the GIT (Git for Subversion Users) talk by <a href="http://www.leftontheweb.com/">Stefan Koopmanschap</a>. And the Dependency Injection presentation by <a href="http://blog.berryllium.nl/">Berry Langerak</a> I didn&#8217;t make it too the last one. But learned a lot while doing the GIT workshop with Stefan.</p>
<p>For the last few months i have wanted to take a look at git. But it just never really took the time to sit down and do it. So this opportunity was there at the right time. Although my laptop died halfway through the workshop. I still was able to make it through the whole session together with <a href="http://accentinteractive.nl/">Joost van Veen</a>. Thanks man. We had a great time. And it was eye opening. Stefan gave a good talk. Helped out where possible. And besides a small <a href="https://github.com/">Github</a> glitch. It was a successful day.</p>
<p>So successful that i decided to make the switch from <a href="http://subversion.tigris.org/">Subversion</a> to <a href="http://git-scm.com/">GIT</a>. Below are some of the steps i took. </p>
<p>The main reasons for me to make the switch</p>
<ul>
<li>Distributed structure make it easy to work from any place. connected or not.</li>
<li>Stashing</li>
<li>Speed and cleaner folder / file structure</li>
<li>Real tags</li>
</ul>
<p>That&#8217;s all for now. but this list will grow. I am sure!
</p>
<h2>Setting up a GIT server</h2>
<p>I decided to go for my own GIT server instead of Github. That&#8217;s just the way i like it. Full control.</p>
<blockquote><p><strong>$</strong> aptitude install git-core</p></blockquote>
<p>Now all we have to do is create a user for git operations. And set the correct permissions.</p>
<blockquote><p>
<strong>$</strong> adduser git<br />
<strong>$</strong> mkdir /home/git/.ssh<br />
<strong>$</strong> chown -R git:git /home/git/.ssh<br />
<strong>$</strong> chmod 700 /home/git
</p></blockquote>
<p>If we want to create a new remote repository. We log in on the git server through SSH and setup a new repository like this.</p>
<blockquote><p>
<strong>$</strong> ssh git@git.domain.tld<br />
<strong>$</strong> mkdir repository.git<br />
<strong>$</strong> cd repository.git<br />
<strong>$</strong> git &#8211;bare init
</p></blockquote>
<p>That&#8217;s all. we now have all we need to connect to git remotely and do some work. But now first we need to import the old Subversion repository. I have found two solid methods for getting the job done.</p>
<h2>Import a SVN project into GIT with git-svn</h2>
<p>First of install git-svn</p>
<blockquote><p><strong>$</strong> sudo aptitude install git-svn</p></blockquote>
<p>Before we start the importing. It&#8217;s good practice to create an author mapping file. So the SVN commiter names match the GIT ones. This is done by creating a simple text file like so.</p>
<blockquote><p>
<strong>$</strong> touch authors.txt<br />
<strong>$</strong> echo &#8220;m0s = Thijs Lensselink <email@lenss.nl>&#8221; > authors.txt
</p></blockquote>
<p>Importing the existing <em>tags</em> and <em>branches</em> is done by adding the <em>&#8211;stdlayout</em> switch</p>
<blockquote><p>
<strong>$</strong> git svn clone &#8211;stdlayout -A authors.txt svn+ssh://user@svnhost/repository repository.git
</p></blockquote>
<p>The problem with this method is that tags and branches are not created properly. I decided to go for the second method down here.</p>
<h2>Import a SVN project into GIT with svn2git</h2>
<p>For this to work we first need ruby and some gems packages.</p>
<blockquote><p>
<strong>$</strong> apt-get install git-svn ruby rubygems<br />
<strong>$</strong> gem install svn2git &#8211;source http://gemcutter.org
</p></blockquote>
<p>Create the local repository and import the files from SVN</p>
<blockquote><p>
<strong>$</strong> mkdir repository.git<br />
<strong>$</strong> cd repository.git<br />
<strong>$</strong> /var/lib/gems/1.8/bin/svn2git svn+ssh://user@svnhost/repository &#8211;authors ../authors.txt
</p></blockquote>
<p>Show the current selected branch</p>
<blockquote><p>
<strong>$</strong> git branch<br />
* master
</p></blockquote>
<p>Show all branches. Notice the <em>trunk</em> branch</p>
<blockquote><p>
<strong>$</strong> git branch -a<br />
* master<br />
  trunk
</p></blockquote>
<p>List all tags</p>
<blockquote><p>
<strong>$</strong> git tag -l<br />
v1.0<br />
v2.0
</p></blockquote>
<p>That seemed to work pretty good for almost all projects. Some projects didn&#8217;t have the main trunk in SVN. So to import these just add the <em>&#8211;rootistrunk</em> switch.</p>
<p>And while this info is still available in my brain at the moment. I will write down some of the workshop material for future reference.</p>
<h2>Setup local Development environment</h2>
<p>Create directory somewhere that will serve as the local repository. And run <em>init</em> to create the basic git project structure.</p>
<blockquote><p>
<strong>$</strong> mkdir [project name]<br />
<strong>$</strong> cd [project name]<br />
<strong>$</strong> git init
</p></blockquote>
<p>Now we have a fully functional git repository. We can do anything with (add, commit, tag, branch, push, etc.)  The first things to do when starting out is setup the user name and email address of the developer using this repository. This is good when looking though the GIT project logs later on. Also handy to set the core editor to the most convenient editor available. </p>
<blockquote><p>
<strong>$</strong> git config &#8211;global user.name &#8220;Thijs Lensselink&#8221;<br />
<strong>$</strong> git config &#8211;global user.email &#8220;email@lenss.nl&#8221;<br />
<strong>$</strong> git config &#8211;global core.editor vi
</p></blockquote>
<p>The repository exists out of a <em>origin</em> and a <em>master</em> branch at this moment. The origin refers to the current repository location. And the master refers to the current repository state. Like HEAD in CVS and SVN. Let&#8217;s add a file for testing.</p>
<blockquote><p>
<strong>$</strong> touch index.php<br />
<strong>$</strong> git add index.php (or add *)<br />
<strong>$</strong> git commit -m &#8220;Commit something&#8221;
</p></blockquote>
<p>Working on a local repository is nice. but we want to save it on a server of course. For this we need to set a repository location. We can do this in two ways. We can overwrite the origin or add a new location. Let&#8217;s try the first one.</p>
<blockquote><p><strong>$</strong> git remote add origin git@git.domain.tld:repository.git</p></blockquote>
<h2>Setting up the remote git repository and push the changes</h2>
<p>All changes to this repository are made locally so far. Let&#8217;s try and push them to the git server. The only problem here is. I haven&#8217;t found a way to create repositories remotely. So we have to log in to the server here and create the repository.</p>
<blockquote><p>
<strong>$</strong> ssh git@git.domain.tld<br />
<strong>$</strong> mkdir repository.git<br />
<strong>$</strong> cd repository.git<br />
<strong>$</strong> git &#8211;bare init<br />
<strong>$</strong> exit
</p></blockquote>
<p>Back on the client side we can now do a push an see what happens.</p>
<blockquote><p>
<strong>$</strong> git push origin master<br />
Counting objects: 3, done.<br />
Writing objects: 100% (3/3), 232 bytes, done.<br />
Total 3 (delta 0), reused 0 (delta 0)<br />
To git@192.168.178.24:foo.git<br />
 * [new branch]      master -> master</p></blockquote>
<p>if you get this error: </p>
<blockquote><p>error: src refspec master does not match any.</p></blockquote>
<p>This means there is no master branch yet. This happens when the repository was created with the &#8211;bare switch. You have to commit a change first before you can push anything to the remote repository server.</p>
<p>That&#8217;s all. We now have a working GIT server and local repository. All that is left is to do some serious development work. On the other hand, before i forget. i will use this space to rehash Stefan&#8217;s workshop for future reference.</p>
<h2>Tagging</h2>
<p>Let start by looking at the way git creates tags. First of there are two types of tags <em>lightweight</em> and <em>annotated</em>. The lightweight version is nothing more then a pointer to a specific commit. It&#8217;s like a branch that doesn&#8217;t change. Annotated tags are a bit different then their lightweight version. And for sure different from the tags in Subversion. A tags in git contains the following data</p>
<ul>
<li>checksum</li>
<li>tagger name</li>
<li>email + date</li>
<li>tag message</li>
<li>GPG signed</li>
</ul>
<p>Creating an annotated tag for version 1 looks something like this</p>
<blockquote><p><strong>$</strong> git tag -a v1.0 -m &#8220;Creating a tag&#8221;</p></blockquote>
<p>Dispaly a certain tag</p>
<blockquote><p><strong>$</strong> git show v1.0</p></blockquote>
<p>I haven&#8217;t had time to look into working with signing of tags. So maybe i will add an entry about that later on.</p>
<h2>Branching</h2>
<p>A repository can have multiple branches. And switching between branches is a since in git. Branching is much like<br />
it is in Subversion.</p>
<p>Create a new branch from master called foo</p>
<blockquote><p>
<strong>$</strong> git branch foo master
</p></blockquote>
<p>Display all branches available. The current branch is highlighted by the * sign</p>
<blockquote><p>
<strong>$</strong> git branch<br />
* master<br />
  foo
</p></blockquote>
<p>Changing branches in git is a piece of cake.</p>
<blockquote><p>
<strong><br />
$</strong> git checkout foo<br />
Switched to branch &#8216;foo&#8217;
</p></blockquote>
<p>There is not much more to branching.</p>
<h2>diff, merge and delete branches</h2>
<p>When adding a new feature to an existing code base. It&#8217;s good practice to create a branch before you start editing. And after everything is done and the change is stable. The branch can be merged back into the master.</p>
<p>First let&#8217;s check if there is a difference between the newly created branch and the master.</p>
<blockquote><p>
<strong>$</strong> git diff foo master<br />
diff &#8211;git a/touch.foo b/touch.foo<br />
deleted file mode 100644<br />
index 257cc56..0000000<br />
&#8212; a/touch.foo<br />
+++ /dev/null<br />
@@ -1 +0,0 @@<br />
-foo
</p></blockquote>
<p>Some changes have been found so let&#8217;s merge them in the master branch</p>
<blockquote><p>
<strong>$</strong> git checkout master<br />
<strong>$</strong> git merge foo master (or git pull foo master)<br />
Already up-to-date with 12d2f9cebaf71a580b021a8eeddc38f267b69e53<br />
Trying simple merge with 4d3dff7e0d2a26302a5884e763fd7a48f5ab4437<br />
Merge made by octopus.<br />
 touch.foo |    1 +<br />
 1 files changed, 1 insertions(+), 0 deletions(-)<br />
 create mode 100644 touch.foo
</p></blockquote>
<p>with <em>git pull</em> it is possible to import branches from other repositories</p>
<p>When done with the changes. And everything is pushed to the remote git server, we can remove the &#8216;foo&#8217; branch</p>
<blockquote><p>
<strong>$</strong> git branch -d foo<br />
Deleted branch foo (was d9a8c76).
</p></blockquote>
<p>That&#8217;s all for branching right now.</p>
<h2>Stashing</h2>
<p>One of my personal favorite the stash command. Imagine working on a project. And somebody asks you to make a small change. In subversion i needed to do a new checkout and work on that. This can be quite slow and cumbersome. In git this is solved elegantly by using the stash command.</p>
<blockquote><p>
<strong>$</strong> git stash<br />
Saved working directory and index state &#8220;WIP on master: 648f347&#8230; foo&#8221;<br />
(To restore them type &#8220;git stash apply&#8221;)<br />
HEAD is now at 648f347 foo
</p></blockquote>
<p>This saves a copy of the working state and let&#8217;s you do changes on a fresh base. After your done get back to your work by doing </p>
<blockquote><p>
<strong>$</strong> git stash pop (or apply)
</p></blockquote>
<p>With pop you push the stash back to the master. With apply the changes will first be applied to the master before restoring the work state.</p>
<h2>Working with other repositories</h2>
<p>Clone a repository from a remote GIT server</p>
<blockquote><p><strong>$</strong> git clone git@git.domain.tld:repository.git ./project2</p></blockquote>
<p>Clone a local GIT repository</p>
<blockquote><p><strong>$</strong> git clone ./project ./project2</p></blockquote>
<p>Now it could be possible a friend or a remote community member without write access made a few changes to his / her remote repository. And wants them on the global remote GIT server. This can be done by pulling the code.</p>
<p>First add the new repository location</p>
<blockquote><p><strong>$</strong> git remote add friend git://githubaddress</p></blockquote>
<p>And then fetch the remote changes</p>
<blockquote><p><strong>$</strong> git fetch friend</p></blockquote>
<p>This only fetches the changes. but does not apply them to the master. Apply them</p>
<blockquote><p><strong>$</strong> git pull friend master</p></blockquote>
<p>updating remote repository</p>
<blockquote><p><strong>$</strong> git push friend master</p></blockquote>
<p>That&#8217;s all i can remember right now.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2010/11/moving-from-subversion-to-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN&#8217;s post-commit script in PHP</title>
		<link>http://lenss.nl/2009/09/svns-post-commit-script-in-php/</link>
		<comments>http://lenss.nl/2009/09/svns-post-commit-script-in-php/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 08:07:42 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[post-commit]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=532</guid>
		<description><![CDATA[I was kinda bored yesterday. And was poking around the SVN hooks scripts. When i noticed the post-commit script i was using was written in Python. Nothing wrong with that. I just wondered how hard it would be to do the same in PHP. So i came up with a little test. Which at this [...]]]></description>
			<content:encoded><![CDATA[<p>I was kinda bored yesterday. And was poking around the SVN hooks scripts. When i noticed the post-commit script i was using was written in Python. Nothing wrong with that. I just wondered how hard it would be to do the same in PHP. So i came up with a little test. Which at this moment lacks error checking and just looks plain ugly. But it does the job. and i only needed a working PHP CLI executable to make it work.</p>
<p>First we set the email address and the location of svnlook. </p>
<pre name="code" class="php">
#!/usr/bin/php
&lt;?php
error_reporting(E_ALL | E_STRICT); 

$address = 'some email address';
$svnlook = '/usr/bin/svnlook';
</pre>
<p>Use the argv array to get to the commandline parameters and build up a SVN statement to get some basic info.</p>
<pre name="code" class="php">
$repository = $_SERVER['argv'][1];
$revision = $_SERVER['argv'][2];

$cmdInfo = "${svnlook} info ${repository} -r ${revision}";

$output = array();
exec($cmdInfo, $output);

$author = $output[0];
$date = $output[1];
$comment = $output[3];
</pre>
<p>Now let&#8217;s get the changes made in this revisions.</p>
<pre name="code" class="php">
$output = array();
$cmdChanges ="${svnlook} diff ${repository} -r ${revision}";
exec($cmdChanges, $output);
</pre>
<p>Once we have the diff contents we can loop through the lines and use some simple regex to highlight the changes. I&#8217;ve added a bit more code to add pre tags for a better visual effect.</p>
<pre name="code" class="php">
$patch = '&lt;pre class="codeBlock">';
$lineCount = count($output);
for ($x=0; $x<=$lineCount; $x++) {

    if ($x > 0 &#038;&#038; strstr($output[$x], 'Modified:')) {
        $patch .= '&lt;/pre>&lt;pre class="codeBlock">';
    }

    $textColor = 'normal';
    if (preg_match('/^\+/', $output[$x])) {
        $textColor = 'positive';
    }
    else if (preg_match('/^-/', $output[$x])) {
        $textColor = 'negative';
    }

    $patch .= '&lt;span class="' . $textColor . '">' . htmlentities($output[$x]) . "&lt;/span>&lt;br>";

    if ($x == $lineCount) {
        $patch .= "&lt;/pre>";
    }
}
</pre>
<p>Now we can build the body for the email that will be generated.</p>
<pre name="code" class="php">
$body .= "Author : " . $author . "&lt;br>";
$body .= "Date : " . $date . "&lt;br>";
$body .= "Comment : " . $comment . "&lt;br>&lt;br>";

$body .= $patch;
</pre>
<p>Add a MIME header so my mail client displays it properly. And send it of through the build in mail() function. </p>
<pre name="code" class="php">
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$bodyHTML = file_get_contents("/path/to/some/HTML/template");
$bodyHTML = str_replace('{EMAIL}', $body, $bodyHTML);

mail($address, 'SVN post-commit', $bodyHTML, $headers);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2009/09/svns-post-commit-script-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Subversion cross platform errors</title>
		<link>http://lenss.nl/2008/11/subversion-cross-platform-errors/</link>
		<comments>http://lenss.nl/2008/11/subversion-cross-platform-errors/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 19:52:18 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=183</guid>
		<description><![CDATA[Yesterday my colleague was complaining he couldn&#8217;t do a normal check out of one of the projects in Subversion. At first i thought it was just something wrong with his local settings. Because i could do the check out just fine. Today when i was thinking about this problem. I quickly realized we are on [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday my colleague was complaining he couldn&#8217;t do a normal check out of one of the projects in Subversion. At first i thought it was just something wrong with his local settings. Because i could do the check out just fine. Today when i was thinking about this problem. I quickly realized we are on two different platforms. He works on Windows while I&#8217;m on Linux.</p>
<p>And since i had to do some Photoshop work today. I took the chance to install Subversion on my Windows partition. When i did a checkout of the failing project. I ran into the same problems as my colleague did before. Two different errors were preventing me from making a complete checkout. The first error:</p>
<blockquote><p><em>svn: In directory &#8216;path/to/some/images&#8217;<br />
svn: Can&#8217;t copy &#8216;path/to/some/images/image.JPG.svn-base&#8217; to &#8216;path/to/some/image.JPG.tmp&#8217;: No such file or directory</em></p></blockquote>
<p>Is caused by multiple files with the same name. At  least to windows it looks like this. Because image.jpg and image.JPG are two different files on Linux. On windows however these two files are one and the same. This causes Subversion to choke. After manually deleting all duplicates from the repositorie it self the problem dissapeared.</p>
<p>The second error was something like:</p>
<blockquote><p>svn: Working copy &#8216;/some/path/\ &#8216; is missing or not locked</p></blockquote>
<p>This one was actually pretty obvious. A file name with an illigal character. I wonder how it got in the repository. The folder name causeing the problems was a folder called &#8216;\ &#8216;. Which was empty. After removing this. I could do a complete checkout again.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2008/11/subversion-cross-platform-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN over SSH in Zend Studio for Eclipse</title>
		<link>http://lenss.nl/2008/08/svn-over-ssh-in-zend-studio-for-eclipse/</link>
		<comments>http://lenss.nl/2008/08/svn-over-ssh-in-zend-studio-for-eclipse/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 09:13:18 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[subclipse]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[tortoise]]></category>
		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://lenss.nl/blog/?p=123</guid>
		<description><![CDATA[This should be pretty damn straight forward. However i ran into some problems while setting this up. At my daily work spot we use SVN over HTTP so we can do NTLM authentication. This sucks in many ways. But most of all it&#8217;s slow. And i mean really slow. Last week i tried to retrieve [...]]]></description>
			<content:encoded><![CDATA[<p>This should be pretty damn straight forward. However i ran into some problems while setting this up. At my daily work spot we use <a href="http://subversion.tigris.org/">SVN</a> over <a href="http://nl.wikipedia.org/wiki/Hypertext_Transfer_Protocol">HTTP</a> so we can do <a href="http://en.wikipedia.org/wiki/NTLM">NTLM</a> authentication. This sucks in many ways. But most of all it&#8217;s slow. And i mean really slow. Last week i tried to retrieve the log information for a project in the repository. This took my IDE 30 minutes. At first i thought my IDE was just being lame on me. But it turns out it&#8217;s SVN over HTTP that&#8217;s the culprit. </p>
<p>So i started to do some testing over the standard svn:// protocol. And retrieving the logs on the same repository took about 2 seconds. Amazing. That&#8217;s enough reason to switch to the svn:// protocol. This however was not possible. Because our network policy doesn&#8217;t allow for multiple log ins. All is centrally stored on some M$ domain controllers. That&#8217;s why SVN over HTTP was used in the first place. End of story i thought. </p>
<p>But i couldn&#8217;t let go of this. The situation becomes less workable every day. So i decided to look around for other options. When i notice some log ins were merged to the *nix boxes. i immediately thought about using SSH in combination with SVN. Logging in on the *nix box was no problem. So let&#8217;s try that with SVN.</p>
<blockquote><p>svn+ssh://location/of/repo</p></blockquote>
<p>This gives an error about a mismatched handshake. And i just couldn&#8217;t get this to work until i found a post made by <a href="http://www.woodwardweb.com/java/000155.html">Martin Woodward</a>. He explains how to setup an environment variable on my local windows machine. To the tortoise PLink executable.</p>
<blockquote><p>Set the environment variable (by right-clicking on My Computer, Properties, Advanced, Environment Variables, New):-<br />
Variable name: SVN_SSH<br />
Variable value: C:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe</p></blockquote>
<p>This seemed to work i thought. i was presented with a login box. But no matter how i tried i couldn&#8217;t login. It just kept giving me the login box. So i opened a SSH session to the server and tried to do the same from there.</p>
<blockquote><p>svn list svn+ssh://location/of/repo</p></blockquote>
<p>After hitting enter i typed my password and got the following message.</p>
<blockquote><p>bash: line 1: svnserve: command not found<br />
svn: Connection closed unexpectedly</p></blockquote>
<p>Now we&#8217;re getting somewhere. So svnserve could not be found. Probably because it&#8217;s not in the $PATH variable. So let&#8217;s add it there.</p>
<blockquote><p>vi .bashrc<br />
PATH=$PATH:/usr/local/bin</p></blockquote>
<p>So let&#8217;s try to get a listing of the repo.</p>
<blockquote><p>svn list svn+ssh://location/of/repo</p></blockquote>
<p>This gave me the following message:</p>
<blockquote><p>svn: No repository found in &#8216;svn+ssh://location/of/repo&#8217;</p></blockquote>
<p>Seems that when you use SVN over SSH you need to give the full location to the repository. Not the web server path but the complete file system path. After changing the webserver path for the file system path everything worked out. From here on adding the repository to eclipse is easy.<br />
I always open the repository view. From there i right click > New > repository Location. The URL to add will look something like</p>
<blockquote><p>svn+ssh://file/system/location/of/repository</p></blockquote>
<p>So now we can enjoy the speed of the svn:// protocol. And the security of SSH. So let&#8217;s do some coding :)</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2008/08/svn-over-ssh-in-zend-studio-for-eclipse/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SVN repository and project structure</title>
		<link>http://lenss.nl/2008/08/svn-repository-and-project-structure/</link>
		<comments>http://lenss.nl/2008/08/svn-repository-and-project-structure/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 09:54:06 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Project]]></category>
		<category><![CDATA[Structure]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://lenss.nl/blog/?p=109</guid>
		<description><![CDATA[When i first started out as a web developer. i didn&#8217;t really mind about structure. Almost every project had different directory structure. And namespaces i never heard off. I noticed that the longer i write code. The more I&#8217;m looking for a basic structure to start from. This can be the structure of a web [...]]]></description>
			<content:encoded><![CDATA[<p>When i first started out as a web developer. i didn&#8217;t really mind about structure. Almost every project had different directory structure. And <a href="http://en.wikipedia.org/wiki/Namespace">namespaces</a> i never heard off. I noticed that the longer i write code. The more I&#8217;m looking for a basic structure to start from. This can be the structure of a web application / site. but also the structure inside the <a href="http://subversion.tigris.org/">SVN</a> repository.</p>
<p>So today i took a bit of time to think about a good structure for our new SVN repository here at the office. After a bit of browsing the web. Looking at other proposals. And looking around our old SVN repository. I came up with a new structure.</p>
<p>Our SVN repository will start off with three directories.</p>
<blockquote><p>
&#8211; Development<br />
&#8211; Design<br />
&#8211; ??
</p></blockquote>
<p>The Development directory is what i will be talking about. I can&#8217;t talk for the designers. Because.. well i&#8217;m not one of them. Although i did a lot of design work in the past. The ?? directory is for another part of our department. So let&#8217;s see what i came up with.</p>
<p>Inside the Development directory we start of with two directories.</p>
<blockquote><p>
&#8211; Projects<br />
&#8211; Library
</p></blockquote>
<p><strong>Projects:</strong><br />
This directory will contain all projects. With projects i mean web applications / sites. All these projects will adhere to a basic structure. Which i will talk about a bit later. Besides the same basic structure. Every projects has the trunk, tags and branches sub directories. If a project contains &#8220;sub&#8221; projects. The trunk, tags and branches will shift one level deeper in the tree. Below is a small example.</p>
<blockquote><p>
&#8211; Project_1<br />
&#8212;- trunk<br />
&#8212;- tags<br />
&#8212;- branches<br />
&#8211; Project_2<br />
&#8212;- www<br />
&#8212;&#8212; trunk<br />
&#8212;&#8212; tags<br />
&#8212;&#8212; branches<br />
&#8212;- intranet<br />
&#8212;&#8212; trunk<br />
&#8212;&#8212; tags<br />
&#8212;&#8212; branches
</p></blockquote>
<p><strong>Library:</strong><br />
The library directory will contain all shared libraries. This can be third party libraries or internally developed libraries that will be used in multiple applications. Below is a small example. I&#8217;m not sure about the trunk, tags, branches directories yet. For the internally developed libraries we will implement this structure. For the third party libraries we won&#8217;t. I think :)</p>
<blockquote><p>
&#8211; Zend<br />
&#8211; DB<br />
&#8212;- trunk<br />
&#8212;- tags<br />
&#8212;- branches
</p></blockquote>
<p>Now this will cover most of the project parts. What&#8217;s left now is defining a basic structure for the projects that will ive inside the repository and on the web servers. For a basic structure i&#8217;m inspired by the layout of an <a href="http://framework.zend.com">Zend Framework</a> <a href="http://nl.wikipedia.org/wiki/Model-View-Controller-model">MVC</a> style project. Why? i already work with this structure for a while now. outside and inside the Zend Framework projects. It separates the code from the views / templates. It makes sure the code is outside the web root. And it just looks clean.</p>
<p>So for our projects i came up with this structure.</p>
<p>The structure really consists of three parts. The first is &#8220;public&#8221;. This directory contains all data that should be globally accessible. We can think about images, stylesheetes, javascript libraries, etc.</p>
<blockquote><p>
&#8211; public<br />
&#8212;- images<br />
&#8212;- css<br />
&#8212;- scripts<br />
&#8212;- index.*
</p></blockquote>
<p>The application directory contains all the real code and views / templates. All views / templates will be stored in the views directory. All project specific code will be placed in the library directory. And if the project is MVC based. It will use the controllers directory to store the application controllers.</p>
<blockquote><p>
&#8211; application<br />
&#8212;- controllers<br />
&#8212;- library<br />
&#8212;- views
</p></blockquote>
<p>The final part of the structure is a collection of directories that can but are not always used in a project. </p>
<p>The logs directory can be handy for logging data of the application. But can also be used to store php error logs or maybe even Apache logs. The cache directory is there to store cached files. The structure inside this directory will depend on the cache mechanism used in the project. The files directory contains files that are somehow linked to the project but have no place in any other directories. Some test scripts or tools can be placed there. And last but not least the docs directory. Which will contain all project documentation.</p>
<blockquote><p>
&#8211; logs<br />
&#8211; cache<br />
&#8211; files<br />
&#8211; docs
</p></blockquote>
<p>I wanted to post this yesterday. But i just couldn&#8217;t find any time for it. Yesterday i showed the initial proposal to the rest of the team. But we didn&#8217;t decide yet. What the final structure will be.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2008/08/svn-repository-and-project-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
