

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

