<?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>Shaaf's Blog &#187; SVN</title>
	<atom:link href="http://www.shaafshah.com/tag/svn/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaafshah.com</link>
	<description>Another bit in the wall</description>
	<lastBuildDate>Wed, 12 Aug 2009 14:28:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SVN &#8211; some quick commands during merge.</title>
		<link>http://www.shaafshah.com/2008/08/25/svn-some-quick-commands-during-merge/</link>
		<comments>http://www.shaafshah.com/2008/08/25/svn-some-quick-commands-during-merge/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 13:55:54 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=36</guid>
		<description><![CDATA[Following are some of the frequently used svn commands during merging and branching. I used to work with tortoise for this but as soon as I learned these, it feels like a more easier space to be in. Although no points taken away from tortoise, it still works pretty good for the gui part, This [...]]]></description>
			<content:encoded><![CDATA[<p>Following are some of the frequently used svn commands during merging and branching. I used to work with tortoise for this but as soon as I learned these, it feels like a more easier space to be in. Although no points taken away from tortoise, it still works pretty good for the gui part, This article is more  targeted towards dark screen lovers.</p>
<p><strong>Create a new branch from trunk:</strong><br />
If you want to create a branch from a specific revision of Trunk following command is handy. It does a remote copy. which means the machine you are on does not need a copy of the whole tree.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> copy <span style="color: #660033;">-r</span> REVISION TRUNK_URL NEW_BRANCH_URL <span style="color: #660033;">--username</span> USERNAME <span style="color: #660033;">--password</span> PASSWORD <span style="color: #660033;">-m</span> MESSAGE</pre></div></div>

<p>An example</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> copy <span style="color: #660033;">-r</span> <span style="color: #000000;">1234</span> http:<span style="color: #000000; font-weight: bold;">//</span>shaafshah.com<span style="color: #000000; font-weight: bold;">/</span>trunk http:<span style="color: #000000; font-weight: bold;">//</span>shaafshah.com<span style="color: #000000; font-weight: bold;">/</span>branches<span style="color: #000000; font-weight: bold;">/</span>MY_BRANCH <span style="color: #660033;">--username</span> foo <span style="color: #660033;">--password</span> bar <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Remote copy&quot;</span></pre></div></div>

<p><strong>When was this branch created?</strong><br />
If you want to know the day branch was created.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> log <span style="color: #660033;">-v</span> <span style="color: #660033;">--stop-on-copy</span> BRANCH_URL</pre></div></div>

<p>The last record will show you the day the branch as created.</p>
<p><strong>List all the branches:</strong><br />
If you want to take a listing of branches or a tree</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> BRANCHES_URL</pre></div></div>

<p>e.g. http://shaafshah.com/branches</p>
<p><strong>Merge from Branch to Trunk:</strong></p>
<p>Browse to where you have checkedout trunk in the local directory.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> shaafshah.com<span style="color: #000000; font-weight: bold;">/</span>trunk</pre></div></div>

<p>Update trunk to HEAD.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> update
At revision 1234.</pre></div></div>

<p>Following will merge from branch to trunk but will not commit.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> merge <span style="color: #660033;">-r</span> BRANCH_REVISION:TRUNK_REVISION BRANCH_URL</pre></div></div>

<p>Branch_REVISION will be the revision branch was created if this is the first time you are doing the merge.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> merge <span style="color: #660033;">-r</span> <span style="color: #000000;">1233</span>:<span style="color: #000000;">1234</span> http:<span style="color: #000000; font-weight: bold;">//</span>shaafshah.com<span style="color: #000000; font-weight: bold;">/</span>branches<span style="color: #000000; font-weight: bold;">/</span>my_new_branch</pre></div></div>

<p>After this you should do an</p>
<p>svn status</p>
<p>to check the status of the files. the files will be marked with following Characters.</p>
<p>&#8216;A&#8217; Added<br />
&#8216;C&#8217; Conflicted<br />
&#8216;D&#8217; Deleted<br />
&#8216;I&#8217; Ignored<br />
&#8216;M&#8217; Modified</p>
<p>If there is any &#8216;C&#8217; in the status the files will not be committed if you try an svn commit to save the merge to the trunk.</p>
<p><strong>Merge from Trunk to Branch:</strong></p>
<p>To merge from Trunk to branch you would need to browse to the branch checked out in the local direcotry.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> shaafshah.com<span style="color: #000000; font-weight: bold;">/</span>branches<span style="color: #000000; font-weight: bold;">/</span>mybranch</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> update
At revision 1234.</pre></div></div>

<p>The following command will try merging trunk from revision 1233 i.e. the day branch was created to branch head.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> merge <span style="color: #660033;">-r</span> <span style="color: #000000;">1233</span>:HEAD TrunkURL BRANCH_URL</pre></div></div>

<p>Hopefully this should help. However you should definitely refer to SVN Book for more detail.</p>
<p>svnbook at <a title="http://svnbook.red-bean.com/" href="http://svnbook.red-bean.com/">http://svnbook.red-bean.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/08/25/svn-some-quick-commands-during-merge/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating an SVN wrap for your build using Ant</title>
		<link>http://www.shaafshah.com/2008/06/30/creating-an-svn-wrap-for-your-build-using-ant/</link>
		<comments>http://www.shaafshah.com/2008/06/30/creating-an-svn-wrap-for-your-build-using-ant/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 12:45:32 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=11</guid>
		<description><![CDATA[Today after along break I would jump right on to one of the interesting topics in my den these days. One of my friends was lately troubled with doing some SVN stuff like merging etc. And a lot of people will agree with me on their first experiences. I think. While Automated builds take a [...]]]></description>
			<content:encoded><![CDATA[<p>Today after along break I would jump right on to one of the interesting topics in my den these days.</p>
<p>One of my friends was lately troubled with doing some SVN stuff like merging etc. And a lot of people will agree with me on their first experiences. <img src='http://www.shaafshah.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I think.</p>
<p>While Automated builds take a lot of our time I thought I could plug in with some automated merging and a few other tasks. Its hard to go over all of that in one post but I will try putting in some basic stuff to get us started.</p>
<p>I call it the SVN Wrap.</p>
<p><strong>Step 1.</strong><br />
Create a simple script file for wrapping svn and our environment.</p>
<p>A simple bat script could look like the following</p>

<div class="wp_syntax"><div class="code"><pre class="bat" style="font-family:monospace;">@echo off
svn %*</pre></div></div>

<p>However some people might want to add some environment variables to it. And that is where the strength of the this file comes in. You can tailor the environment dynamically!<br />
e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="bat" style="font-family:monospace;">set LC_ALL=C
set SVN_HOME=svn-win32-1.4.6
set PATH=%SVN_HOME%\bin;%PATH%;</pre></div></div>

<p><strong>FYI:</strong> By setting LC_ALL I am telling the system I disregard the default locale. Its just used as an example here. for more information refer to the svnbook at <a title="http://svnbook.red-bean.com/" href="http://svnbook.red-bean.com/">http://svnbook.red-bean.com/</a></p>
<p><strong>Step 2. </strong><br />
Create the build.xml<br />
It doesnt get simpler then this.</p>
<p>I have created a project with the name CI-Test</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;CI-Test&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;status&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		This is a POC for SVN Wrap.
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Importantly I am setting a property local.branch so that I can tell svn where my code has been checked out locally.</p>
<p>And finally the target that will take a status of the branch. for more details on the status command you could go here.</p>
<p>In general this target will give a general overview of the files and thier state at the moment.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;status&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Following is the status for this tree.&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;output is logged here: status.out&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${local.branch}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;ci-svn.bat&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;status.out&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;status&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>With in the target there are a few echo commands but the key construct is the exec.<br />
The exec is going to do the following</p>
<p><strong>dir</strong>=&#8221;${local.branch}&#8221; &#8211; would meant execute the command in this directory<br />
<strong>executable</strong>=&#8221;ci-svn.bat&#8221; &#8211; Identifies the executable<br />
and finally the output attribute to show where the output of this activity goes.<br />
The following line will pass the parameters to the executable<br />
<strong>&lt; arg line=&#8221;status&#8221; /&gt;</strong><br />
And in this case its sending a status command to svn.</p>
<p>For more details on exec goto. <a title="http://ant.apache.org/manual/" href="http://ant.apache.org/manual/">http://ant.apache.org/manual/</a></p>
<p>Now I would presume both these files in saved in one direcotry as</p>
<p>1. ci-svn.bat<br />
2. build.xml</p>
<p>To run this simply goto your command console and once in the same directory execute by running<br />
ant</p>
<p>It is assumed that all paths to java,ant and svn are set on your console or system.</p>
<p>As an output you should be able to see a status.out in the same directory from where you executed ant.</p>
<p>Hopefully this should get you started with doing some bit of svn commands from ant. And that just opens a lot of more possibilities in your build environment.</p>
<p>The complete code listing of the build file is as follows.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;CI-Test&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;status&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		This is a POC for SVN Wrap.
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;local.branch&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;C:\branches\my-branch&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;status&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Following is the status for this tree.&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;output is logged here: status.out&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${local.branch}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;ci-svn.bat&quot;</span> <span style="color: #000066;">output</span>=<span style="color: #ff0000;">&quot;status.out&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">line</span>=<span style="color: #ff0000;">&quot;status&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/06/30/creating-an-svn-wrap-for-your-build-using-ant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
