<?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>Casey A. McLaughlin &#187; version control</title>
	<atom:link href="http://www.caseymclaughlin.com/tags/version-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.caseymclaughlin.com</link>
	<description>Online Portfolio</description>
	<lastBuildDate>Fri, 30 Sep 2011 13:10:26 +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>Setup a local configuration file in Codeigniter</title>
		<link>http://www.caseymclaughlin.com/2011/04/setup-a-local-configuration-file-in-codeigniter/</link>
		<comments>http://www.caseymclaughlin.com/2011/04/setup-a-local-configuration-file-in-codeigniter/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 20:59:37 +0000</pubDate>
		<dc:creator>McLaughlin Casey</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[local config]]></category>
		<category><![CDATA[portability]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.caseymclaughlin.com/?p=316</guid>
		<description><![CDATA[In this article, I describe how to create a CodeIgniter local config file that overrides settings in the main config.php file in order to improve portability among different environments.]]></description>
			<content:encoded><![CDATA[<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.type=&amp;rft.format=text&amp;rft.title=Setup a local configuration file in Codeigniter&amp;rft.source=Casey A. McLaughlin&amp;rft.date=2011-04-29&amp;rft.identifier=http://www.caseymclaughlin.com/2011/04/setup-a-local-configuration-file-in-codeigniter/&amp;rft.language=English&amp;rft.aulast=McLaughlin&amp;rft.aufirst=Casey&amp;rft.subject=Web Development"></span>
<p><a href="http://www.caseymclaughlin.com/wp-content/uploads/2011/04/3019282806_ce005967b2.jpg"><img src="http://www.caseymclaughlin.com/wp-content/uploads/2011/04/3019282806_ce005967b2-150x150.jpg" alt="Even if you have twenty local environments on //one freaking computer//, this technique still works :)" title="Even if you have twenty local environments on //one freaking computer//, this technique still works :)" width="150" height="150" class="alignright size-thumbnail wp-image-326" /></a>After four years of development, I&#8217;m still a big <a title="CodeIgniter Homepage" href='http://codeigniter.com'>CodeIgniter</a> fan, although some <a title="FuelPHP Website" href="http://fuelphp.com/">other</a> <a title="Kohana Website" href="http://kohanaframework.org/">frameworks</a> are starting to look mighty interesting.  Despite the bugs in Version 2.0.2, however, CI is heading in the right direction.</p>
<p>One CI-related issue that has caused problems for my workplace in the past has been the ability to setup distributed development environments.  Everybody has a different local setup, and some of the configuration directives inside of CI&#8217;s <em>application/config</em> folder must change from machine to machine.</p>
<p>Of course, we can&#8217;t just tell Mercurial to ignore that folder during commits, because there are some configuration directives that <em>should</em> remain the same across all environments, such as <em>language, charset, enable_hooks, etc</em>.</p>
<p>So, how to make some configuration settings consistent across different computers, and how to make some local settings?<br />
<span id="more-316"></span></p>
<a name="Enter%3A+config.local.php."></a><h3>Enter: <em>config.local.php</em>.</h3>
<p>The solution is to create a local configuration file that overrides default <em>config.php</em> settings.  This way, local environments can set certain settings locally, and use the defaults in the <em>application/config</em> folder by default.  Here&#8217;s how to do it:</p>
<p><strong>Step One:</strong> Create a local configuration file, and add certain configuration settings that you want to override.  You can put it in your root folder, and name it <em>./config.local.php</em> For example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Local Configuration Options */</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;base_url&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://localhost/projects/my_project/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;index_page&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;index.php&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;uri_protocol&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;AUTO&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;email_protocol&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;sendmail&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;mailpath&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/usr/bin/sendmail&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;smtp_host&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;smtp_user&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;smtp_pass&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;smtp_port&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;25&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;smtp_timeout&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;5&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'log_threshold'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//..and whatever else you want to override..</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* EOF */</span></pre></td></tr></table></div>

<p><strong>Step Two:</strong> Set your version control system to ignore this file.  If you&#8217;re using Mercurial, simply add a line to the <em>.hgignore</em> file:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">^config\.local\.php$</pre></td></tr></table></div>

<p><strong>Step Three:</strong> Subclass the <em>core/Config.php</em> library to read the local configuration file after reading the default one every time.  To do this, create the file <em>application/core/MY_Config.php</em> in your application folder, and add the following code inside that file:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> MY_Config <span style="color: #000000; font-weight: bold;">extends</span> CI_Config
<span style="color: #009900;">&#123;</span>
	<span style="color: #009933; font-style: italic;">/**
	 * Load a config file - Overrides built-in CodeIgniter config file loader
	 * 
	 * @param string $file
	 * @param boolean $use_sections
	 * @param boolean $fail_gracefully 
	 */</span>
	<span style="color: #000000; font-weight: bold;">function</span> load<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$use_sections</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fail_gracefully</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$use_sections</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fail_gracefully</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//Local settings override permanent settings always.</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_readable</span><span style="color: #009900;">&#40;</span>FCPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'system/config.local.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
			parent<span style="color: #339933;">::</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'system/config.local.php'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$use_sections</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fail_gracefully</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* EOF: MY_Config */</span></pre></td></tr></table></div>

<a name="Using+local+settings+for+database+Configuration"></a><h3>Using local settings for database Configuration</h3>
<p>Another file that is likely to be completely different from one environment to the next is the <em>application/config/database.php</em> file.  Since CodeIgniter seems to read the database settings a bit differently than normal settings, we have to go through one extra step to override those.  It&#8217;s a bit messier than I&#8217;d like, but gets the job done:</p>
<p><strong>Step One</strong>: Add a line to your <em>config.local.php </em>for each database setting you want to override, but put the database settings in their own sub-array:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//...inside the local config file...</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;hostname&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;username&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localuser&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;database&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;oeg_dev&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;db_debug&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;TRUE&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;db&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;dbdriver&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;mysql&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Step Two</strong>: Add the following code to the end of the <em>application/config/database.php</em> file to read those settings after reading the default settings:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//If there is a local config file, overwrite the settings with that..</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_readable</span><span style="color: #009900;">&#40;</span>FCPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'config.local.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span>FCPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'config.local.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$db</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$val</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>There you have it!  From now on, you can your local configuration file to override any configuration setting in CodeIgniter.  This makes sharing code a breeze.  You developers can set their own <em>base_path</em>, <em>database</em>, <em>index_file</em> and other settings that are likely to change from one environment to the next without modifying the main configuration files.</p>
<p><strong>PS.</strong> Happy Friday!</p>
<p><strong>PPS.</strong> Have a better method?  I&#8217;d love to hear about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caseymclaughlin.com/2011/04/setup-a-local-configuration-file-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My Mercurial Workflow</title>
		<link>http://www.caseymclaughlin.com/2010/11/my-mercurial-workflow/</link>
		<comments>http://www.caseymclaughlin.com/2010/11/my-mercurial-workflow/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 17:39:56 +0000</pubDate>
		<dc:creator>McLaughlin Casey</dc:creator>
				<category><![CDATA[IT Management]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[diagrams]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[vcs]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.caseymclaughlin.com/?p=282</guid>
		<description><![CDATA[This post contains a few diagrams I worked up for colleagues at work to describe the Mercurial workflow.]]></description>
			<content:encoded><![CDATA[<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.type=&amp;rft.format=text&amp;rft.title=My Mercurial Workflow&amp;rft.source=Casey A. McLaughlin&amp;rft.date=2010-11-22&amp;rft.identifier=http://www.caseymclaughlin.com/2010/11/my-mercurial-workflow/&amp;rft.language=English&amp;rft.aulast=McLaughlin&amp;rft.aufirst=Casey&amp;rft.subject=IT Management&amp;rft.subject=Web Development"></span>
<p><a href="http://www.caseymclaughlin.com/wp-content/uploads/2010/11/programming_principles.jpg"><img class="alignright size-thumbnail wp-image-294" title="Programming Principles" src="http://www.caseymclaughlin.com/wp-content/uploads/2010/11/programming_principles-150x150.jpg" alt="Where does VCS fit in here?" width="150" height="150" /></a>About a year ago, I wrote an article on this website about Version Control.  In <a title="VCS .. The early days :)" href="http://www.caseymclaughlin.com/2009/12/make-codeigniter-svn-friendly/">that article</a>, I touted the glory of Subversion, and mentioned:</p>
<blockquote><p>&#8220;I&#8217;ve since tried other VCS systems like <a title="Mercurial Homepage" href="http://mercurial.selenic.com/">Mercurial</a>, <a title="Git Homepage" href="http://git-scm.com/">Git</a>, and <a title="Bazaar Homepage" href="http://bazaar.canonical.com/en/">Bazaar</a>, but have not found any compelling reason to switch.&#8221;</p></blockquote>
<p>Well, I&#8217;ve since found my compelling reasons to switch.  SVN lost some of our files, and it was a pain to do all sorts of stuff (get setup, keep clean, branch, merge, etc).  I won&#8217;t get into; there are <a title="Google will show you." href="http://www.google.com/search?sourceid=chrome&amp;ie=UTF-8&amp;q=subversion+sucks">enough rants about Subversion</a> on the &#8216;net already.  We use Mercurial now, and boy has our workflow improved.</p>
<p>Mercurial is my new favorite child, because it&#8217;s easy to setup, easy to use, easy to branch and merge, and easy to teach to my students.  Oh, and it just works.  <a title="I got rather excited in September." href="http://twitter.com/#!/caseyamcl/status/23944288332">Sometimes</a> I think it runs off magic.<span id="more-282"></span></p>
<p>In order to help my colleagues make the transition from SVN to Hg, I came up with a few diagrams to explain the workflow.  I thought I&#8217;d share them here.</p>
<a name="Mercurial+Recipe+for+Success"></a><h2>Mercurial Recipe for Success</h2>
<a name="You+will+Need%3A"></a><h5>You will Need:</h5>
<ol>
<li>Mercurial.  <a title="Hg Website." href="http://mercurial.selenic.com/">Grab and install it from the official site</a>.</li>
<li>Your files.  You know, all of those <em>css, html, </em>and<em> php</em> files that you&#8217;ve been working so hard on.</li>
<li>A repository server.  If you don&#8217;t have one, go get a free account at <a title="Bitbucket Mercurial Hosting (Free)" href="http://www.bitbucket.org">Bitbucket</a>.</li>
<li>A web server.  Install Mercurial here too.</li>
</ol>
<a name="The+Workflow%3A"></a><h5>The Workflow:</h5>
<div id="attachment_286" class="wp-caption aligncenter" style="width: 608px"><a href="http://www.caseymclaughlin.com/wp-content/uploads/2010/11/Hg-Setup.png"><img class="size-full wp-image-286 " title="Hg Setup" src="http://www.caseymclaughlin.com/wp-content/uploads/2010/11/Hg-Setup.png" alt="Diagram showing steps to setup a Mercurial Repository" width="598" height="338" /></a><p class="wp-caption-text">Setting up a Mercurial Repository</p></div>
<div id="attachment_287" class="wp-caption aligncenter" style="width: 608px"><a href="http://www.caseymclaughlin.com/wp-content/uploads/2010/11/Hg-Workflow.png"><img class="size-full wp-image-287 " title="Hg Workflow" src="http://www.caseymclaughlin.com/wp-content/uploads/2010/11/Hg-Workflow.png" alt="Diagram showing day-to-day Hg Workflow" width="598" height="305" /></a><p class="wp-caption-text">Day-to-Day Developer Workflow</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.caseymclaughlin.com/2010/11/my-mercurial-workflow/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Biting the Distributed Development Bullet</title>
		<link>http://www.caseymclaughlin.com/2009/12/make-codeigniter-svn-friendly/</link>
		<comments>http://www.caseymclaughlin.com/2009/12/make-codeigniter-svn-friendly/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 20:15:46 +0000</pubDate>
		<dc:creator>McLaughlin Casey</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[project management]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.caseymclaughlin.com/?p=129</guid>
		<description><![CDATA[You're a dummy for not using version control.  If I can do it, anybody can.]]></description>
			<content:encoded><![CDATA[<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.type=&amp;rft.format=text&amp;rft.title=Biting the Distributed Development Bullet&amp;rft.source=Casey A. McLaughlin&amp;rft.date=2009-12-21&amp;rft.identifier=http://www.caseymclaughlin.com/2009/12/make-codeigniter-svn-friendly/&amp;rft.language=English&amp;rft.aulast=McLaughlin&amp;rft.aufirst=Casey&amp;rft.subject=Web Development"></span>
<p><a href="http://www.caseymclaughlin.com/wp-content/uploads/2009/12/programmer.jpg"><img class="alignright size-thumbnail wp-image-131" title="programmer" src="http://www.caseymclaughlin.com/wp-content/uploads/2009/12/programmer-150x150.jpg" alt="Will Code for Food" width="150" height="150" /></a>Like most development n00bs, after I started using version control, I never looked back.  And <a title="Stack Overflow Thread" href="http://spedr.com/k1z1">neither should you</a>.</p>
<p>It required me to change the whole way that my office operated, though.  See, the way that we were doing things before seemed so simple; we just edited files and shouted at each other if we collided in our editing.  As it turns out, this was a bad thing, and there have been better alternatives around way longer than I&#8217;ve even been in this business.</p>
<p>But like most crotchety, over-egotistical developer-types it took a while for me to come around.  Here&#8217;s a brief history of my flirtations and eventual commitment to version control.</p>
<a name="Our+Blissful%2C+Youthful+Ignorance"></a><h3><span id="more-129"></span>Our Blissful, Youthful Ignorance</h3>
<p>This wasn&#8217;t really that long ago&#8230;</p>
<div id="attachment_139" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.caseymclaughlin.com/wp-content/uploads/2009/12/Workflow-SSH.png"><img class="size-medium wp-image-139" title="The Old Workflow" src="http://www.caseymclaughlin.com/wp-content/uploads/2009/12/Workflow-SSH-300x237.png" alt="The old, SSH-based Workflow" width="300" height="237" /></a><p class="wp-caption-text">1..2..3... Easy Peasy Japanesey.. and stupid.</p></div>
<p>We would all work directly on the files directly on our development server.  We would sit down, SSH into the server using our favorite editor and code away, never thinking of change management, reverting back to old versions, or who would be responsible for what.  Conflict resolution seemed easy&#8230; if I was editing a file named<em> welcome.php</em>, I would simply shout across the room, &#8220;Hey Mike&#8211;don&#8217;t work on <em>welcome.php</em> right now, or I&#8217;ll have to beat you!&#8221;.</p>
<p>Our revision control system consisted of me creating and storing weekly backups of the entire database and file system.  If we made a change that killed the system, we&#8217;d simply either lose that week&#8217;s work or spend hours debugging it.  It was all gloriously simple.</p>
<a name="Version+Control+Puberty+%26%238212%3B+The+Angsty+Years"></a><h3>Version Control Puberty &#8212; The Angsty Years</h3>
<p>One day, I decided to implement Subversion, mainly because other developers were sneering at me and telling me I was a dummy.  And while I didn&#8217;t want to be a dummy, the whole thing seemed overly complicated.  Why would I want to increase complication when everything was working so simple?  I also had some fundamental issues with this new version control idea:</p>
<ul>
<li>First off, everybody has to have to get their own copy of the entire file set.  Bad!  Doom! Insecure! I have to trust my developers with the codebase? ::Gasp::</li>
<li>Secondly, what do you mean that developers can&#8217;t see their changes on the server immediately upon commit without some hacked hook system?  This means they&#8217;ll have to run <a title="Wikipedia LAMP" href="http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29">LAMP</a> on their local boxes, too!  Geez.. now we have to have local dev environment setup procedures, too..</li>
<li>Finally, SVN requires management of its own.  You know.. backing up, securing access, and generally managing.  More overhead and more complication!</li>
</ul>
<p>Grudgingly, in order to remove the &#8220;dummy&#8221; label from my operations, I implemented Subversion.  It was difficult at first to understand how it would fit easily into our procedures, but with some <a title="Subversion Book - Basic Work Cycle (a very helpful chapter)" href="http://svnbook.red-bean.com/en/1.5/svn.tour.cycle.html">very helpful free online material</a>, we started using it.</p>
<p>And sure, I <em>did</em> have to write procedures for setting up local dev environments AND install a subversion clients AND manage a <a title="Hands Down, VisualSVN is the easist-to-use SVN Server for Windows" href="http://www.visualsvn.com/server/">repository server</a>, but you know what?</p>
<p>All of that stuff was way worth it.</p>
<a name="All+Grown-up+Now"></a><h3>All Grown-up Now</h3>
<p>Let me repeat that: whatever frustrations version control causes, they are all worth it.</p>
<p>After being SVN disciples for a while now, our development procedures have matured.  Here&#8217;s how we do things:</p>
<div id="attachment_137" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.caseymclaughlin.com/wp-content/uploads/2009/12/Workflow-SVN.png"><img class="size-medium wp-image-137" title="SVN Workflow" src="http://www.caseymclaughlin.com/wp-content/uploads/2009/12/Workflow-SVN-300x242.png" alt="The way we do things now" width="300" height="242" /></a><p class="wp-caption-text">The way we do things now.. Much better!</p></div>
<p>I&#8217;ve since tried other VCS systems like <a title="Mercurial Homepage" href="http://mercurial.selenic.com/">Mercurial</a>, <a title="Git Homepage" href="http://git-scm.com/">Git</a>, and <a title="Bazaar Homepage" href="http://bazaar.canonical.com/en/">Bazaar</a>, but have not found any compelling reason to switch.   Either way, using version control has saved our sorry butts on more than one occasion and has made life easier in about 1,001 ways.</p>
<p>As a bonus, it has also forced us to use better procedures and generate better development documentation, which is amazing, because we&#8217;re pretty lazy.  Now if only we could find a tool to better force us to behave when it comes to unit testing&#8230;</p>
<p>Well, that&#8217;s my story.  If I&#8217;ve inspired you to use VCS, hooray!  <a title="Awesome SVN Primer I found on the front page of Google search" href="http://www.snipe.net/2009/03/getting-started-with-subversion/">Here&#8217;s a helpful place to get started</a>.  If not, you&#8217;re a dummy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caseymclaughlin.com/2009/12/make-codeigniter-svn-friendly/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

