<?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>Jayway Team Blog &#187; subversion</title>
	<atom:link href="http://blog.jayway.com/tag/subversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jayway.com</link>
	<description>Sharing Experience</description>
	<lastBuildDate>Sat, 11 Feb 2012 10:33:02 +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>Using Git with Subversion</title>
		<link>http://blog.jayway.com/2010/09/02/using-git-with-subversion/</link>
		<comments>http://blog.jayway.com/2010/09/02/using-git-with-subversion/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 07:45:26 +0000</pubDate>
		<dc:creator>Anders Janmyr</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=6260</guid>
		<description><![CDATA[I had the unfortunate experience of having to use Subversion again after using Git for a long time. It is amazing how fast I can forget. After renaming a directory at the prompt, and the agony that goes with it, I decided to switch back to Git. $ mv requester sampler # svn agony after [...]]]></description>
			<content:encoded><![CDATA[<p>I had the unfortunate experience of having to use Subversion again after using Git for a long time. It is amazing how fast I can forget. After renaming a directory at the prompt, and the agony that goes with it, I decided to switch back to Git.</p>
<p><!-- Generator: GNU source-highlight 3.1.4<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt>$ mv requester sampler
<i><font color="#9A1900"># svn agony after renaming a directory</font></i>
$ svn st
<font color="#990000">?</font>       sampler
<font color="#990000">!</font>       requester
<font color="#990000">!</font>       requester<font color="#990000">.</font>rb
A       sampler<font color="#990000">.</font>rb

</tt></pre>
<p>The tool to use when using Git with Subversion is, of course, <code>git svn</code>.</p>
<p><code>git svn</code> works very well as long as you remember that <em>Subversion is not Git</em>. It does not handle merging well, and it will bite you if you don't respect that. So what does this actually mean? It means:</p>
<h2>Always keep the Git master in sync with Subversion</h2>
<p>To do this you have two commands you can use.</p>
<p><!-- Generator: GNU source-highlight 3.1.4<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><i><font color="#9A1900"># Rebases the commits from the upstream Subversion server with your local master.</font></i>
$ git svn rebase

</tt></pre>
<p>You should only <code>git svn rebase</code> in your Git master, and you should <strong>ALWAYS</strong> do it before you <code>git svn dcommit</code> anything to the subversion repository. <code>git svn rebase</code> keeps the upstream subversion in sync with your local master by pulling down the changes, kind of like <code>svn update</code>.</p>
<p><!-- Generator: GNU source-highlight 3.1.4<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><i><font color="#9A1900"># Commits the changes you have in your local master to the upstream Subversion server.</font></i>
$ git svn dcommit

</tt></pre>
<p>When you have changes ready to commit, you commit them to subversion with <code>git svn dcommit</code>. You should <strong>ALWAYS</strong> <code>git svn rebase</code> before you do the update, or it will fail.</p>
<p>That's it! As long as you follow these two simple rules, your life with <code>git svn</code> will be easy. If you forget to follow them, you will be bitten. When you get bitten, the cool thing about Git is that even if you screw up, it is always possible to sort it out.</p>
<p>It that was all there was to it, there would be no reason to use Git instead of Subversion. Git really shines when it comes to branching and merging. You may create as many local branches as you like with <code>git branch branch_name</code> or <code>git checkout -b branch_name</code>. You can hack around in these local branches as much as you want and merge them together. But, before you merge them into the master branch, <strong>you must rebase with master! Not merge, rebase!</strong> Rebase means replay the commits on top of the named branch. It creates new commits, the same content, but with a different SHA-1.</p>
<p><!-- Generator: GNU source-highlight 3.1.4<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><i><font color="#9A1900"># Example session</font></i>

<font color="#990000">(</font>master<font color="#990000">)</font>$ git svn rebase
<font color="#990000">(</font>master<font color="#990000">)</font>$ git checkout -b dev
hack<font color="#990000">,</font> hack<font color="#990000">,</font> hack<font color="#990000">,</font> <font color="#990000">...</font>
<font color="#990000">(</font>dev<font color="#990000">)</font>$ git commit -am <font color="#FF0000">'Commit the changes'</font> 

<font color="#990000">(</font>dev<font color="#990000">)</font>$ git checkout master
<font color="#990000">(</font>master<font color="#990000">)</font>$ git checkout -b bugfix
hack<font color="#990000">,</font> hack<font color="#990000">,</font> hack<font color="#990000">,</font> <font color="#990000">...,</font> <b><font color="#0000FF">done</font></b>

<font color="#990000">(</font>bugfix<font color="#990000">)</font>$ git checkout master
<font color="#990000">(</font>master<font color="#990000">)</font>$ git svn rebase
<font color="#990000">(</font>master<font color="#990000">)</font>$ git checkout bugfix
$ git rebase master
<font color="#990000">(</font>bugfix<font color="#990000">)</font>$ git checkout master
<font color="#990000">(</font>master<font color="#990000">)</font>$ git merge --ff bugfix <i><font color="#9A1900"># --ff only fast-forwards, merges that don't need to merge. </font></i>
<font color="#990000">(</font>master<font color="#990000">)</font>$ git svn dcommit
<font color="#990000">(</font>master<font color="#990000">)</font>$ git branch -D bugfix <i><font color="#9A1900"># delete the branch it is not needed anymore</font></i>

<font color="#990000">(</font>master<font color="#990000">)</font>$ git checkout dev
hack<font color="#990000">,</font> hack<font color="#990000">,</font> hack<font color="#990000">,</font> <font color="#990000">...,</font> <b><font color="#0000FF">done</font></b>

<font color="#990000">(</font>dev<font color="#990000">)</font>$ git checkout master
<font color="#990000">(</font>master<font color="#990000">)</font>$ git svn rebase
<font color="#990000">(</font>master<font color="#990000">)</font>$ git checkout dev
<font color="#990000">(</font>dev<font color="#990000">)</font>$ git rebase master
<font color="#990000">(</font>dev<font color="#990000">)</font>$ git checkout master
<font color="#990000">(</font>master<font color="#990000">)</font>$ git merge --ff dev <i><font color="#9A1900"># --ff only fast-forwards, merges that don't need to merge.</font></i>
<font color="#990000">(</font>master<font color="#990000">)</font>$ git svn dcommit

</tt></pre>
<p>Another thing to be aware of is that <code>git svn dcommit</code> creates an extra commit, so even if you haven't changed anything in the master you need to rebase the local branch with the master. This is only needed if you don't delete the branches after you are done with a commit.</p>
<p>In the example above, I ended with a <code>git svn dcommit</code> and I didn't remove the <code>dev</code> branch.</p>
<p><!-- Generator: GNU source-highlight 3.1.4<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><font color="#990000">(</font>master<font color="#990000">)</font>$ git svn dcommit <i><font color="#9A1900"># from above</font></i>
<font color="#990000">(</font>master<font color="#990000">)</font>$ git co dev
<font color="#990000">(</font>dev<font color="#990000">)</font>$ git rebase master <i><font color="#9A1900"># rebases the extra commit created by git svn dcommit</font></i>

</tt></pre>
<p>If you forget to rebase or something else happens that hinders a clean merge into the master. You can always back out of it with <code>git reset --hard</code>.</p>
<p><!-- Generator: GNU source-highlight 3.1.4<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt><font color="#990000">(</font>master<font color="#990000">)</font>$ git svn dcommit
<font color="#990000">...</font> failed miserably<font color="#990000">,</font> because I failed to git svn rebase<font color="#990000">,</font> bollocks<font color="#990000">!</font>
<font color="#990000">(</font>aa<font color="#990000">..</font>88dd<font color="#990000">|</font>MERGING<font color="#990000">)</font>$ git reset --hard
<font color="#990000">(</font>master<font color="#990000">)</font>$ git svn rebase
<font color="#990000">(</font>master<font color="#990000">)</font>$ git svn dcommit <i><font color="#9A1900"># Nice and clean commit</font></i>

</tt></pre>
<p>To get started you need to clone a subversion repository.</p>
<p><!-- Generator: GNU source-highlight 3.1.4<br />
by Lorenzo Bettini</p>
<p>http://www.lorenzobettini.it</p>
<p>http://www.gnu.org/software/src-highlite --></p>
<pre><tt>$ git svn clone http<font color="#990000">:</font>//svn<font color="#990000">.</font>example<font color="#990000">.</font>com/project/trunk
$ cd trunk
<font color="#990000">(</font>master<font color="#990000">)</font>$ git <font color="#990000">...</font>

</tt></pre>
<p>Now, is a good time to start using Git. Get yourself anything by Scott Chacon, such as the <a href="http://www.amazon.com/Pro-Git-Scott-Chacon/dp/1430218339?tag=thtasta-20">book</a> or the <a href="http://www.gitcasts.com/">screencasts</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2010/09/02/using-git-with-subversion/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Maven automatic build versioning and Git against Subversion</title>
		<link>http://blog.jayway.com/2009/06/04/maven-automatic-build-versioning-and-git-against-subversion/</link>
		<comments>http://blog.jayway.com/2009/06/04/maven-automatic-build-versioning-and-git-against-subversion/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 14:36:13 +0000</pubDate>
		<dc:creator>Erik Ogenvik</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[version controlling]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=1869</guid>
		<description><![CDATA[If you use Git locally against a Subversion repository you might run into problems if your project is set up to generate automatic build numbers through the buildnumber-maven-plugin, since the plugin might be setup to get the build numbers from Subversion. Through some use of additional profiles you can work around this.]]></description>
			<content:encoded><![CDATA[<p>One of the nicest features of Git is that it's possible to use it locally against a Subversion server. For many this is a crucial selling point as it allows individual developers to take advantage of Git while not requiring that the entire project switches version control from Subversion. On your local Git repository you're then free to do as many branches as you like, or otherwise take advantage of the many nice features in Git.<span id="more-1869"></span></p>
<p>However, if your project is set up to use the Maven automatic build versioning as provided by the buildnumber-maven-plugin you will run into problems if it is set to get the build numbers from the Subversion revision number. Since your local checkout is against Git, and not Subversion, the build will fail since the Subversion commands won't work.<br />
One solution for this could be to alter the plugin configuration to get the build number from the date or something similar, but that's not always possible. You might have a build server setup that depends on the build number matching the revision number, and imposing such a change might break other functionality or processes.</p>
<p>Instead you can add an additional profile to the Maven POM which will only be triggered in the absence of a .svn directory (i.e. when not using Subversion). In this profile you can override the default configuration for the build number generator to instead use the date for build numbers. This means that your builds will have different build numbers from the integration builds, but at least it will compile on your git checkout.</p>
<p>The profile will look like this:</p>
<pre>&lt;profile&gt;
  &lt;!--
  This profile is here for triggering when another scm than svn is
  used (for example git). Instead of getting the version build number
  from svn we will use the build date and the user name.
  --&gt;
  &lt;id&gt;buildnumber-git&lt;/id&gt;
  &lt;activation&gt;
    &lt;file&gt;
      &lt;missing&gt;.svn&lt;/missing&gt;
    &lt;/file&gt;
  &lt;/activation&gt;
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
        &lt;artifactId&gt;buildnumber-maven-plugin&lt;/artifactId&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;phase&gt;generate-resources&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;create&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
        &lt;configuration&gt;
          &lt;doCheck&gt;false&lt;/doCheck&gt;
          &lt;doUpdate&gt;false&lt;/doUpdate&gt;
          &lt;format&gt;{0,date,yyyy-MM-dd_HH-mm}_{1}&lt;/format&gt;
          &lt;items&gt;
            &lt;item&gt;timestamp&lt;/item&gt;
            &lt;item&gt;${user.name}&lt;/item&gt;
          &lt;/items&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
&lt;/profile&gt;</pre>
<p>This way Subversion and Git users can live happily together in the same project.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2009/06/04/maven-automatic-build-versioning-and-git-against-subversion/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting up a local Subversion repository to use with your Eclipse</title>
		<link>http://blog.jayway.com/2009/04/03/setting-up-a-local-subversion-repository-to-use-with-your-eclipse/</link>
		<comments>http://blog.jayway.com/2009/04/03/setting-up-a-local-subversion-repository-to-use-with-your-eclipse/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 08:33:48 +0000</pubDate>
		<dc:creator>Rickard Nilsson</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[local]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[subclipse]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=1498</guid>
		<description><![CDATA[I've been spending some time studying a tool for looking at the structure of code bases. After having tried out some of the more basic possibilities I wanted to go for the finer points and study changes between two versions of code to see what effect my changes made. This is where I realise that [...]]]></description>
			<content:encoded><![CDATA[<p>I've been spending some time studying a tool for looking at the structure of code bases. After having tried out some of the more basic possibilities I wanted to go for the finer points and study changes between two versions of code to see what effect my changes made. This is where I realise that I would like to have a local Subversion repository not only for this,  but also for how it would benefit some of my hobby projects. After some googling I found my way to <a href="http://subversion.tigris.org/project_packages.html">http://subversion.tigris.org/project_packages.html</a> where, since I'm on windows, I picked the windows path. I end up downloading the latest version of Subversion:  <a href="http://subversion.tigris.org/files/documents/15/45344/svn-win32-1.6.0.zip">http://subversion.tigris.org/files/documents/15/45344/svn-win32-1.6.0.zip</a></p>
<p>I unpack it in "C:\Program Files\Subversion". To get the commands to work you have to add the  bin to your path. In my case I add "C:\Program Files\Subversion\svn-win32-1.5.6\bin" to the path. After this I open up a  command window and do the following:</p>
<pre lang="text">
mkdir subversionRepository
cd subversionRepository
svnadmin create project1
</pre>
<p>Now, in order to make Subversion work in Eclipse I add http://subclipse.tigris.org/update_1.6.x  to my update sites. After downloading this I restart my Eclipse and go to Window -> Show View ->Other->SVN -> SVN Repositories.<br />
I right click in the opened view and create a new repository location. Instead of writing a http adress in the URL window I now type "file:///C:/subversionRepository/project1". Notice the three forward slashes after "file:".</p>
<p>I now have an empty repository that I want to put my project into so I right click on the repository and add a new remote folder that I call trunk. Right clicking on the trunk I can now import my project by importing the folder that contains the .project file. I hit F5 to refresh the view and can see that the trunk is now filled with my first version of my project.</p>
<p>But I also have to associate the repository version with Eclipse, so now I right click in the Package Explorer and choose Import -> SVN -> Checkout Projects from SVN. I pick my previously created repository, click next, mark the trunk and then click finish. I get a question if I want to overwrite my previously created project with the same name and say ok. I won't need that now that I got a versioning system! </p>
<p>I can now finally continue my studies of the tool I was looking into.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2009/04/03/setting-up-a-local-subversion-repository-to-use-with-your-eclipse/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Solving 403 problems with Sourceforge Subversion</title>
		<link>http://blog.jayway.com/2007/01/13/solving-403-problems-with-sourceforge-subversion/</link>
		<comments>http://blog.jayway.com/2007/01/13/solving-403-problems-with-sourceforge-subversion/#comments</comments>
		<pubDate>Sat, 13 Jan 2007 16:54:42 +0000</pubDate>
		<dc:creator>Ulrik Sandberg</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[sourceforge]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.jayway.com/?p=177</guid>
		<description><![CDATA[After having had severe problems when committing to the Sourceforge Subversion repos, I stumbled upon what appears to be the solution. The problem was that in the middle of a commit, one file or directory would fail with a 403 (permission denied). In desperation, I would chop up the change set and commit little pieces [...]]]></description>
			<content:encoded><![CDATA[<p>After having had severe problems when committing to the Sourceforge Subversion repos, I stumbled upon what appears to be the solution. The problem was that in the middle of a commit, one file or directory would fail with a 403 (permission denied). In desperation, I would chop up the change set and commit little pieces at the time, until only the ones with problems remained. I would then perform desperate unnamed actions with these until they eventually were committed. Pretty nerve-wrecking, time-consuming, and unproductive stuff. The worst part is that if you split the change set, you could end up splitting a move operation, which is basically a copy and a delete. Say that you commit the delete operation successfully first. Then you try to commit the copy, which will fail with a 404 (not found), since the stuff it tries to copy has been deleted. There are ways around it, but I won't describe them here. Horrible stuff.</p>
<p>I had seen somewhere that you could get the 403 error if you were using SSL (which I was) and the Sourceforge server <tt>svn.sourceforge.net</tt>. The correct server is the <tt>PROJECTNAME.svn.sourceforge.net</tt>, where <tt>PROJECTNAME</tt> in my case was <tt>springframework</tt>. So <b>the correct URL to use is <tt>https://springframework.svn.sourceforge.net/svnroot/springframework/</tt>.</b> This meant changing the checkout URL, which Subversion can do on an already checked-out working copy, using the <tt>switch</tt> command. Cool. When I tried this, it failed because it couldn't find the new server. The problem was that the DNS servers I was using at some point didn't find this server, and probably cached this negative hit. Eventually I found a DNS that could locate this server and performed the switch. Things have been working much better since.</p>
<p>Using the incorrect server, which most likely is a proxy server of some sort, could possibly have resulted in different physical servers being used for different requests during the Subversion transaction. It's not allowed to perform a <tt>svn copy</tt> operation between repositories. You'll get a 403 if you try it. Perhaps that rule applied to my situation as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jayway.com/2007/01/13/solving-403-problems-with-sourceforge-subversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

