<?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>lab.joelGillman.com &#187; source control</title>
	<atom:link href="http://lab.joelgillman.com/archives/tag/source-control/feed" rel="self" type="application/rss+xml" />
	<link>http://lab.joelgillman.com</link>
	<description>Sketches, Code Bites and Toys</description>
	<lastBuildDate>Tue, 12 Jul 2011 15:03:29 +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>Pseudo Work (fwork)</title>
		<link>http://lab.joelgillman.com/archives/159_pseudo-work</link>
		<comments>http://lab.joelgillman.com/archives/159_pseudo-work#comments</comments>
		<pubDate>Thu, 05 Nov 2009 22:16:30 +0000</pubDate>
		<dc:creator>joel gillman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[source control]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://lab.joelgillman.com/?p=159</guid>
		<description><![CDATA[This script takes a text file (any text file should) and displays it one line at a time with short delays in between. In other words, you can run this script to make it look like your computer is actually doing something worthwhile. I had searched around the internet a few times but never really [...]]]></description>
			<content:encoded><![CDATA[<p>This script takes a text file (any text file should) and displays it one line at a time with short delays in between.  In other words, you can run this script to make it <em>look</em> like your computer is actually doing something worthwhile.</p>
<p>I had searched around the internet a few times but never really found anything like this, but that doesn&#8217;t mean it doesn&#8217;t look.  Maybe I&#8217;m just a bad internet searcher.  <a href="http://lab.joelgillman.com/archives/159_pseudo-work">Script after the jump</a>. <span id="more-159"></span></p>
<p><br/></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<br />
<span style="color: #666666; font-style: italic;">#####################################################</span><br />
<span style="color: #666666; font-style: italic;"># Pseudo Work (fwork) Script - by Joel Gillman 2009</span><br />
<span style="color: #666666; font-style: italic;"># lab.joelgillman.com/archives/159_pseudo-work</span><br />
<span style="color: #666666; font-style: italic;"># </span><br />
<span style="color: #666666; font-style: italic;"># Please feel free to edit and change this as you</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;like! If &nbsp;you do make any edits I would be curious</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;to see what you've done so drop me a line!</span><br />
<span style="color: #666666; font-style: italic;"># </span><br />
<span style="color: #666666; font-style: italic;"># DISCLAIMER</span><br />
<span style="color: #666666; font-style: italic;"># I am in no way a bash scripting expert. Most of what</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;I write is copy and paste and trial and error.</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;While this script shouldn't hurt anything in your</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;system don't hold me responsible if it does! Use</span><br />
<span style="color: #666666; font-style: italic;"># &nbsp;at your own risk.</span><br />
<span style="color: #666666; font-style: italic;">#####################################################</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">## test if file (default or otherwise)</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">''</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #007800;">filename</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$HOME</span>/garbage.txt&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$filename</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">0</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No file specified and default file '~/garbage.txt' not found.&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #007800;">filename</span>=<span style="color: #007800;">$1</span><br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No file found at $1&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #666666; font-style: italic;">## execute fakeness</span><br />
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> p; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(($RANDOM % 10)</span>)&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = (<span style="color: #007800;">$RANDOM</span> % 2)&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(($RANDOM % 50)</span>)&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = (<span style="color: #007800;">$RANDOM</span> % 20)&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R1 = 0&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;R2 = (<span style="color: #007800;">$RANDOM</span> % 10)&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$p</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #007800;">$R1</span>.<span style="color: #007800;">$R2</span><br />
<span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$filename</span></div></div>
<p><a href="http://lab.joelgillman.com/thepress/wp-content/uploads/2009/11/fwork.zip">Download a zip&#8217;d version of the script</a>.<br />
You can <a href="http://lab.joelgillman.com/thepress/wp-content/uploads/2009/11/garbage.txt">download the (2.5MB) text file</a> I&#8217;ve been using.</p>
<p>Let me know what you think!  Any improvements or suggestions would be greatly appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.joelgillman.com/archives/159_pseudo-work/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN For Newbies</title>
		<link>http://lab.joelgillman.com/archives/103_svn-for-newbies</link>
		<comments>http://lab.joelgillman.com/archives/103_svn-for-newbies#comments</comments>
		<pubDate>Thu, 05 Feb 2009 16:06:05 +0000</pubDate>
		<dc:creator>joel gillman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[source control]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://lab.joelgillman.com/?p=103</guid>
		<description><![CDATA[SVN is confusing, or at least it can be for people who don&#8217;t know their way around the Terminal or aren&#8217;t exactly sure what SVN is. I was confused by it for a long time and I&#8217;m decently technologically inclined. (+1 spelling) This article is intended for those who are forced to use SVN against [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://subversion.tigris.org/">SVN is confusing</a>, or at least it can be for people who don&#8217;t know their way around the Terminal or <a href="http://en.wikipedia.org/wiki/Subversion_(software)">aren&#8217;t exactly sure what SVN is</a>. I was confused by it for a long time and I&#8217;m decently technologically inclined. (+1 spelling) This article is intended for those who are forced to use SVN against their will and I will be very explicit and redundant about what is happening and why.</p>
<p>SVN can be learned!<br/>&nbsp;<br />
You too can learn to love it!<br/>&nbsp;<span id="more-103"></span></p>
<p>Some technical information first, I&#8217;m writing on a mac and I use SVN on a mac. If you ALSO are on a mac, you&#8217;ll need to have the latest Developer Tools installed. They&#8217;re not installed by default so if you haven&#8217;t done this already you should do that now. If you&#8217;ve lost the install CD that came with your computer you can grab it <a href="http://developer.apple.com/technology/xcode.html">here</a> for free (it&#8217;s a <stroke>big</stroke> HUGE download). You probably won&#8217;t use 90% of the stuff that it installs, but there&#8217;s some background stuff going on that you&#8217;ll need (SVN for example).<br/>&nbsp;</p>
<p>Check to see if SVN is installed, open Terminal (Applications > Utilities) and type &#8220;svn&#8221;.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">svn</span><br />
Type <span style="color: #ff0000;">'svn help'</span> <span style="color: #000000; font-weight: bold;">for</span> usage.</div></div>
<p>If you see something similar, it worked! If not, sorry, try Google.</p>
<p>OKAY, install done. There are <a href="http://www.syncrosvnclient.com/">several</a> <a href="http://versionsapp.com/">graphical</a> <a href="http://www.lachoseinteractive.net/en/community/subversion/svnx/features/?sid=099cc11e3657867741478a20916b43b4">interfaces</a> <a href="http://odetoapple.com/2006/svn-plugin-for-finder/">for</a> <a href="http://www.panic.com/coda/">SVN</a> but I&#8217;ve found that none of them can really compare to the command line interface (someone will hate me for saying that). Even if you use a GUI for SVN, sometimes something will break and the program won&#8217;t be able to fix it.<br/>&nbsp;</p>
<p>First I&#8217;ll cover some Terminal basics to help you get around.<br/>&nbsp;</p>
<p>How to change directories (folders):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>the<span style="color: #000000; font-weight: bold;">/</span>directory<span style="color: #000000; font-weight: bold;">/</span>you<span style="color: #000000; font-weight: bold;">/</span>want<span style="color: #000000; font-weight: bold;">/</span></div></div>
<p>cd, which probably stands for &#8220;change directory&#8221; is how you&#8217;re going to get around. If you&#8217;re in the terminal, you&#8217;re using cd all the time.</p>
<p>This following commands will take you to the root (<em>Macintosh HD</em>), your home folder (<em>/Users/yourname/</em>), and up one folder, respectively.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..</div></div>
<p>&nbsp;</p>
<p>Want to see what other folders/files are in the directory you&#8217;re in?</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">ls</span></div></div>
<p>If you get lost you can use &#8220;pwd&#8221; which will return the current directory that you are in. (Print Working Directory)</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #7a0874; font-weight: bold;">pwd</span></div></div>
<p>&nbsp;</p>
<p>Cluttered screen? Try this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">clear</span></div></div>
<p>Okay, that should be enough to get you scooting around nicely. Let&#8217;s get into some SVN goodness! So first you&#8217;re probably going to want to &#8220;checkout&#8221; a copy of the repository (or repo as I will call it from now on). First cd into the directory where you&#8217;d like your local copy to be. I usually checkout to <em>~/myUserName/Sites/</em> because I&#8217;m usually working with websites, but you can put yours wherever you like. Then get the URL to the repo. You&#8217;ll probably get this from the IT guys or from someone sitting next to you. The following will checkout the repo &#8220;superImportantProject&#8221; which will put a folder called &#8220;superImportantProject&#8221; in whatever directory you&#8217;re currently in.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn checkout</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.companywebsite.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>lgn<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>superImportantProject</div></div>
<p>At this point, assuming you typed the url in correctly, you&#8217;ll see a bunch of text start to appear on your screen. If it&#8217;s going slow enough you can see each file that it&#8217;s downloading to your computer. Magic! You&#8217;ll know it&#8217;s done when you&#8217;ve been returned to the prompt. So you just downloaded a bunch of files to your computer, la-dee-dah. Now&#8217;s when you do your thing and jump into the folder, edit a bunch of copy, add some new images, delete some redundant files.</p>
<p>Great! All done for now, finished what you needed? Cool, now it&#8217;s time to CHECK IN YOUR CHANGES! First, before checking in your changes you want to see if anyone else has made changes to the repo while you&#8217;ve been working.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">svn update</span></div></div>
<p>&nbsp;</p>
<p>Hold your breath while it checks &#8211; with any luck no one has made any changes, or at least no changes that have to do with your files. If no changes have been made you&#8217;ll see something like this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">At revision <span style="color: #000000;">764</span>.</div></div>
<p>&nbsp;</p>
<p>If changes <em>have</em> been made you&#8217;ll see something like:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">A &nbsp; &nbsp; &nbsp;public/mainpage.html<br />
D &nbsp; &nbsp; &nbsp;public/fullpage.swf<br />
A &nbsp; &nbsp; &nbsp;public/index.html<br />
A &nbsp; &nbsp; &nbsp;public/thank_you.html<br />
A &nbsp; &nbsp; &nbsp;public/why_use_svn.html<br />
A &nbsp; &nbsp; &nbsp;public/images/sweetpic.jpg<br />
U &nbsp; &nbsp; &nbsp;public/images/yourmom.jpg<br />
U &nbsp; &nbsp; &nbsp;public/images/lolz.gif<br />
Updated to revision 765.</div></div>
<p>The letters before each file tell you what is happening to that file. A for added, D for deleted, U for updated.  If you, god forbid, see a C, that means conflict.  If you see that, you&#8217;re fucked.  Well&#8230;at least you are until you read the part where I talk about that.  But that&#8217;s later!</p>
<p>Okay, so you didn&#8217;t see the dreaded C of conflict. On to the next step. Double check to see what files you&#8217;ve changed/added:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">svn status</span></div></div>
<p>&nbsp;</p>
<p>Now a list of all the files you changed, added and deleted will be displayed.  Mine looks like this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">M &nbsp; &nbsp; &nbsp;index.php<br />
M &nbsp; &nbsp; &nbsp;footer.php<br />
? &nbsp; &nbsp; &nbsp;images<span style="color: #000000; font-weight: bold;">/</span>my_logo.jpg<br />
? &nbsp; &nbsp; &nbsp;images<span style="color: #000000; font-weight: bold;">/</span>sweet_image_4.gif<br />
<span style="color: #000000; font-weight: bold;">!</span> &nbsp; &nbsp; &nbsp;redundant.html</div></div>
<p>Woah, what&#8217;s all that crap mean?  M means that you modified a file (most common).  A ? means that file isn&#8217;t under version control (it&#8217;s not in entered into svn yet).  The ! means that a file is missing.</p>
<p>Well let&#8217;s add those ? files into svn first because those are pretty important for my project.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">svn add</span> images<span style="color: #000000; font-weight: bold;">/</span>my_logo.jpg<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn add</span> images<span style="color: #000000; font-weight: bold;">/</span>sweet_image_4.gif</div></div>
<p>&nbsp;</p>
<p>Or you can string the files together (separated by a space) and add a bunch of files at the same time:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">svn add</span> images<span style="color: #000000; font-weight: bold;">/</span>my_logo.jpg images<span style="color: #000000; font-weight: bold;">/</span>sweet_image_4.gif</div></div>
<p>&nbsp;</p>
<p>Now run &#8216;svn status&#8217; again:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">svn status</span><br />
M &nbsp; &nbsp; &nbsp;index.php<br />
M &nbsp; &nbsp; &nbsp;footer.php<br />
A &nbsp; &nbsp; &nbsp;images<span style="color: #000000; font-weight: bold;">/</span>my_logo.jpg<br />
A &nbsp; &nbsp; &nbsp;images<span style="color: #000000; font-weight: bold;">/</span>sweet_image_4.gif<br />
<span style="color: #000000; font-weight: bold;">!</span> &nbsp; &nbsp; &nbsp;redundant.html</div></div>
<p>&nbsp;</p>
<p>Cool, we&#8217;ve got the A of added so those files are ready to go.  Now about that missing file (!).  Did you really mean to delete it?  Does it need to be deleted?  Is anyone going to miss this file?  Think about that for a bit because if you delete that file out of the repository you&#8217;re deleting it for everyone else, too.  Still want to get it out of there?  Okay, but be careful with this one.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">svn remove</span> redundant.html</div></div>
<p>&nbsp;</p>
<p>Almost too easy, right? &#8216;svn status&#8217; one more time before we commit just to make doubly sure.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">svn status</span><br />
M &nbsp; &nbsp; &nbsp;index.php<br />
M &nbsp; &nbsp; &nbsp;footer.php<br />
A &nbsp; &nbsp; &nbsp;images<span style="color: #000000; font-weight: bold;">/</span>my_logo.jpg<br />
A &nbsp; &nbsp; &nbsp;images<span style="color: #000000; font-weight: bold;">/</span>sweet_image_4.gif<br />
D &nbsp; &nbsp; &nbsp;redundant.html</div></div>
<p>Awesome, all the files we changed know what they&#8217;re doing now.  It should be said at this time that it&#8217;s okay to leave files unadded and missing (? and !) but they will be ignored when you commit to the repository.</p>
<p>Time to commit:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span><span style="color: #c20cb9; font-weight: bold;">svn commit</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Changed header copy. Added new images to homepage.&quot;</span></div></div>
<p>The -m in there is an &#8220;option&#8221;.  You&#8217;re telling the command &#8216;svn commit&#8217; to look for a message with your commit.  The commit command won&#8217;t work without a message so you&#8217;ll always need to do that.  The actual message can be as explicit or as vague as you like, just know that the message is logged and can be helpful later if you need to go back and find changes you had made in the past.</p>
<p>Hey, congrats!  You know all the basics of svn to get you through the day!<br/>&nbsp;</p>
<p>This next bit holds some basic tricks to clear up any problems you might have as you flounder your way around svn.<br/>&nbsp;</p>
<p><strong>Crap.  I deleted a file that I didn&#8217;t mean to, how can I get it back?!</strong><br />
Well if you deleted the file locally and didn&#8217;t delete it with &#8216;svn remove&#8217; that&#8217;s easy!  Just run &#8216;svn update&#8217; and you&#8217;ll grab any new files along with any you might be missing. If you deleted it with &#8216;svn remove&#8217; then WHAT THE HELL?!  What were you thinking?!  Fuck, just keep reading for now.</p>
<p><strong>Crap. I&#8217;m getting the dreaded C of conflict.</strong><br />
Oh no!  When this happens svn makes a bunch of crazy-ass files.  Let&#8217;s just say your file was called &#8220;example.html&#8221; because I&#8217;m not feeling very creative right now.  Now you&#8217;ve got:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">example.html<br />
example.html.mine<br />
example.html.r767<br />
example.html.r768</div></div>
<p>If you were to take a look in the example.html file right now you&#8217;d potentially see a bunch of weird code that isn&#8217;t yours.  The file that has all of your changes in it is now called &#8220;example.html.mine&#8221;.  The other two files (r767 and r768) are the revision you were editing from (r767) and the latest revision that&#8217;s in the repository (r768).  The easiest way out of this is to decide what version is the right one.</p>
<ul>
<li>Your co-worker has been working there for years and is way smarter than you, so just assume what they did it is right.  Turn to page 768.  Er, go with revision r768.</li>
<li>Your co-worker is worthless which is why you were hired, your changes are right.  Go with your copy (.mine).</li>
<li>Both of you are idiots so let&#8217;s just start over and let the senior devs deal with it. Go with the old revision (.r767).</li>
</ul>
<p>Whatever you decide, you&#8217;ve got to copy the file you want to go with over the original file then tell svn you&#8217;ve resolved the problem.  My co-worker&#8217;s changes are usually right so I&#8217;ll just go with his:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">cp</span> example.html.r768 example.html<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn resolved</span> example.html<br />
Resolved conflicted state of <span style="color: #ff0000;">'example.html'</span></div></div>
<p>The &#8216;cp&#8217; command is used to copy file A to file B.</p>
<p>That should cover you for awhile&#8230; Once you get the hang of this stuff you shouldn&#8217;t have too much of a problem learning the rest yourself.  If not, I&#8217;m still here!</p>
]]></content:encoded>
			<wfw:commentRss>http://lab.joelgillman.com/archives/103_svn-for-newbies/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

