<?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>Smartkey - Java Software Consultancy &#187; Subversion</title>
	<atom:link href="http://blog.smartkey.co.uk/tag/subversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartkey.co.uk</link>
	<description></description>
	<lastBuildDate>Tue, 13 Dec 2011 15:03:46 +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>Resolving Subservsion Tree Conflicts when Merging</title>
		<link>http://blog.smartkey.co.uk/2010/05/resolving-subversion-conflicts/</link>
		<comments>http://blog.smartkey.co.uk/2010/05/resolving-subversion-conflicts/#comments</comments>
		<pubDate>Thu, 13 May 2010 10:10:18 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Conflict]]></category>
		<category><![CDATA[Merge]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=721</guid>
		<description><![CDATA[When merging changes in a Subversion project, you&#8217;ll need to resolve any conflicts between your checked out version and the one that you are about to merge from the server. Commonly, conflicts arise when two or more developers have modified the same file; these can be resolved by accepting either parties changes or by completing [...]]]></description>
			<content:encoded><![CDATA[<p>When merging changes in a Subversion project, you&#8217;ll need to resolve any conflicts between your checked out version and the one that you are about to merge from the server. Commonly, conflicts arise when two or more developers have modified the same file; these can be resolved by accepting either parties changes or by completing a more detailed merge. </p>
<p>Another common conflicts is a Tree Conflict. Tree conflicts arise when the directory layout of the project changes, and can arise when folders and files are moved, deleted or created. Such conflics will cause a capital &#8216;C&#8217; to appear in the svn status commands output &#8211; these must be resolved before your merge can take place so that svn knows what it should do with the files that will be merged. Note that you should treat these conflicts carefully and ensure that anyone else who may be affected by the changes is happy with the resolution you are about to apply.</p>
<p>Once you&#8217;ve agreed on how the conflicts will be fixed, you can use the <strong>svn resolve</strong> command to determine what action should be taken suring the merge.</p>
<p>For example:</p>
<pre class="brush: php">
svn resolve --accept mine-full /path/to/folder
</pre>
<p>indicates that the local changes should be used. </p>
<p>In contrast, if the changes from the server are to be used, then use this:</p>
<pre class="brush: php">
svn resolve --accept theirs-full /path/to/folder
</pre>
<p>Be aware that the above instruction will cause the local changes to be lost.</p>
<p>There are a number of different options to select (in addition to mine-full and theirs-full) that give you more control over resolving, or postponing, the conflict. See the excellent SVN manual for deails of these.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2010/05/resolving-subversion-conflicts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ignoring Files and Directories in a Subversion Project</title>
		<link>http://blog.smartkey.co.uk/2009/12/ignoring-files-and-directories-subversion/</link>
		<comments>http://blog.smartkey.co.uk/2009/12/ignoring-files-and-directories-subversion/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 11:58:07 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tool support]]></category>
		<category><![CDATA[Ignore]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=566</guid>
		<description><![CDATA[Configuring Subversion to ignore files can sometimes cause confusion. Like most things though, if you understand the basic principles, then its not tricky at all. In this post I'll demonstrate just how you should go about ignoring files in a subversion project. ]]></description>
			<content:encoded><![CDATA[<p>Configuring Subversion to ignore files can sometimes cause confusion. Like most things though, if you understand the basic principles, then its not tricky at all. In this post I&#8217;ll demonstrate just how you should go about ignoring files in a subversion project.</p>
<p>There are two ways to ignore files in svn: global settings and local. Global settings configure the users environment with some rules for ignoring files, but generally the local ignores are more useful and will be discussed here.</p>
<p>Most projects have files that should be ignored and not included in the version repository. For example, in Java projects, the compiler output shouldn&#8217;t be included as these can be regenerated from the source anyway. You might also have temporary cache files being generated, or output from running unit tests that you don&#8217;t want to share too.</p>
<h3>Ignoring files and directories</h3>
<p>Each directory in a svn managed project has a sub-directory called .svn which contains configuration information that svn uses when working in that directory. To make svn ignore certain content within a directory you need to configure an <strong>svn:ignore</strong> property for it.</p>
<p>To demonstrate this let&#8217;s work with the following project directory structure:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">myproject/build/classes</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">myproject/log.txt</div>
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">myproject/log-2009-12-01.txt
myproject/log-2009-12-02.txt
myproject/build/classes</pre>
<p>First let&#8217;s tell svn to ignore the log files that have been created. I&#8217;m using SVN 1.5.4 on a Mac so I&#8217;ll demonstrate this using a command line but you could do much the same using a GUI tool like Tortoise:</p>
<pre>$ svn propset svn:ignore 'log-*.txt' myproject</pre>
<p>The above command has used the <strong>propset</strong> command to set the <strong>svn:ignore</strong> property value to <strong>log-*.txt</strong> for the <strong>myproject</strong> directory.</p>
<p>Note that it is possible to use a wild-card &#8216;*&#8217; as part of the file name. You can also use the &#8216;?&#8217; symbol to match a single character in a file name but svn does not currently support any more powerful matching features.</p>
<p><em>Importantly note also that the file name must be quoted in order that the literal value is passed to the svn command; without this the shell will process the wild-card and pass all matching file names instead.</em></p>
<p>You can inspect the value of this property using the propget command like this:</p>
<pre>$ svn propget svn:ignore myproject
log-*.txt</pre>
<p>An ignore property can also be applied to directories, causing all files and sub-directories within it to be ignored. To make svn ignore the classes directory and its contents we could use the command:</p>
<pre style="font: normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">$ svn propset svn:ignore 'classes' myproject/build</pre>
<h3>Setting multiple ignore rules within a directory</h3>
<p>So far we&#8217;ve looked at how we can set an individual ignore rule within a directory using the <strong>propset</strong> command. Although both of the rules we&#8217;ve demonstrated have resulted in multiple files being ignored, either by using a wild card syntax or by specifying a directory whose content will also be ignored, we&#8217;ve not yet discussed is how these rules can be combined within a directory; for example: to ignore all log files and also a sub-directory:</p>
<pre>/myproject/log-2009-12-01.txt
/myproject/log-2009-12-02.txt
/myproject/classes</pre>
<p>The <strong>svn:ignore</strong> property is actually a list of file name patterns that svn must ignore. The propset command simply overwrites that list with a single line that includes the pattern you specify when you issue the command.</p>
<p>To create a list of file names that will be matched, use the <strong>propedit</strong> command instead:</p>
<pre>$ svn propedit svn:ignore myproject</pre>
<p>Your svn editor will then be started and you can edit the list of filenames that must be ignored. For our example it would need to look like this:</p>
<pre>log-*.txt
classes</pre>
<p>Note that each file name pattern must be on a separate line.</p>
<h3>Ignoring versioned files and directories</h3>
<p>You must be aware that the <strong>svn:ignore</strong> properties only apply to any files that are <em>not</em> under version control.</p>
<p>In practical terms this means if you accidentally add a file or directory to your version control, you will need to explicitly issue a svn delete command (rm) in order that svn will ignore the files.</p>
<p>Commands like <strong>add</strong> and <strong>import</strong> work recursively in svn, so it&#8217;s easy to accidentally add files like those mentioned above to a versioned project. For example if our log files were accidentally added we could issue this command to delete them from svn:</p>
<pre>svn rm log*.txt</pre>
<p>Note this time that the filename is not quoted as we want the shell to pass all log files to be deleted.</p>
<p>After committing the changes to the project, the files will no longer be managed by svn and the ignore properties will once again work.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2009/12/ignoring-files-and-directories-subversion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Unix Command to Recursively Delete all .svn Folders</title>
		<link>http://blog.smartkey.co.uk/2009/11/recursively-delete-svn-folders/</link>
		<comments>http://blog.smartkey.co.uk/2009/11/recursively-delete-svn-folders/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 11:26:39 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tool support]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Unix / Linux]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=554</guid>
		<description><![CDATA[I recently needed to check out a project from Subversion and then delete all of the .svn files from the project directories. Google found me a few different ways to do this, but none of them seemed to deal with a case where some of the directory and file names had spaces or quotes in them – as mine did. After a little experimenting, I figured out how some simple Unix commands that could be combined using pipes to do this.]]></description>
			<content:encoded><![CDATA[<p>I recently needed to check out a project from Subversion and then delete all of the .svn files from the project directories. Google found me a few different ways to do this, but none of them seemed to deal with a case where some of the directory and file names had spaces or quotes in them &#8211; as mine did.</p>
<p>After a little experimenting, I figured out the following commands could be combined as illustrated below:</p>
<p>From within the project root folder this command can be used to list all of the .svn directories:</p>
<pre>$ find . -type d -name .svn</pre>
<p>If your directory names don&#8217;t have spaces or quotes in them, then you could just pipe the find command directly into xargs and rm to delete them all:</p>
<pre>$ find . -type d -name .svn | xargs rm -rf</pre>
<p>If you do have spaces or quotes in your directory names, then you need to change the newlines returned from find into null characters (notice the -print0 flag), and make xargs use this to split the input into individual file names (see the -0 flag) rather than the newlines, spaces and quotes that it normally looks for:</p>
<pre>$ find . -type d -name .svn -print0 | xargs -0 rm -fr</pre>
<p>The above command will delete all directories named &#8216;.svn&#8217;, regardless of whether they have spaces, or quote characters in their names.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2009/11/recursively-delete-svn-folders/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Branching and Merging with Subversion (SVN)</title>
		<link>http://blog.smartkey.co.uk/2009/11/branching-and-merging-with-subversion-svn/</link>
		<comments>http://blog.smartkey.co.uk/2009/11/branching-and-merging-with-subversion-svn/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 10:38:46 +0000</pubDate>
		<dc:creator>Steve Neal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tool support]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://blog.smartkey.co.uk/?p=291</guid>
		<description><![CDATA[Working in the head revision of a versioning system isn't a great idea. It's much better to work in a branch and to merge the changes once you're convinced they are stable. This post demonstrates how to do this with Subversion.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s generally considered bad practice to work directly in the head revision (aka. the trunk) of an SVN managed project. Undoing changes committed in the head is difficult, and if there are a number of developers working on different features, then updates to the code will be visible to all and may cause problems.</p>
<p>It&#8217;s much better to work in a branch and to merge the changes once you&#8217;re convinced they are stable. This post demonstrates how to do this using the Subversion command line tools; however, the same principles would apply if you were using a GUI tool like Tortoise for example.</p>
<h3>Creating a branch</h3>
<p>Creating a branch is simple. You just copy the revision you want to make changes to into the branches folder of your project in the SVN repository, for example:</p>
<pre>svn copy http://svnserver/myproject/trunk http://svnserver/myproject/branches/stevescopy</pre>
<p>This will create a copy of the head revision in the project called &#8216;myproject&#8217; in a branch folder called &#8217;stevescopy&#8217; on the SVN server found at &#8217;svnserver&#8217;.</p>
<p>You may notice when doing this that the copy operation completes very quickly, this is because no files are actually copied, SVN just copies markers to file versions making branching a very cheap and fast operation to perform.</p>
<p>Next you should check out the branch before working on it in the usual manner. So, following the previous example, we could check out our branch using:</p>
<pre>svn co http://svnserver/myproject/branches/stevescopy .</pre>
<p>When working on the code in the branch, you should feel free to commit changes as frequently as you like. The changes that you make are now completely separate from the head revision.</p>
<h3>Merging changes back to the trunk</h3>
<p>When you&#8217;re ready to merge whatever updates you&#8217;ve been working on back into the trunk, you should first commit all changes in your branch. To do this, issue the SVN commit command from the working directory of your branch:</p>
<pre>svn commit -m 'committing the branch before merging'</pre>
<p>Next, in a separate directory, check out the version of the project that you want to merge your changes into.  In our case we want to merge our changes back into the head revision:</p>
<pre>svn co http://svnserver/myproject/trunk .</pre>
<p>Now we can perform the merge. The merge does not change the data held in the repository, instead it updates the local copy that we have just checked out. So, from the directory into which we just checked out the trunk, we should issue a command to merge the changes from our branch:</p>
<pre>svn merge http://svnserver/myproject/branches/stevescopy</pre>
<p>SVN will now update all the files in this working copy with the changes made in our branch. If there are conflicts (i.e. another user has updated the original trunk files since you checked them out) then SVN will detect this and it will ask you to resolve them. Once completed, you should check that your project builds and passes all of its tests before committing your merged copy back to the trunk:</p>
<pre>svn commit -m 'committing with updates from the stevescopy branch'</pre>
<h3>Cleaning up</h3>
<p>If you don&#8217;t plan to do any more work on the branch, you can delete it using something like this:</p>
<pre>svn rm http://svnserver/myproject/branches/stevescopy</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.smartkey.co.uk/2009/11/branching-and-merging-with-subversion-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

