<?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>Coding Clarity &#187; version control</title>
	<atom:link href="http://chrisdail.com/tag/version-control/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisdail.com</link>
	<description>Writing simple, clear and readable code.</description>
	<lastBuildDate>Mon, 30 Aug 2010 11:45:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Version Control and Bug tracking Integration (with Subversion and Bugzilla)</title>
		<link>http://chrisdail.com/2010/02/09/version-control-and-bug-tracking-integratio/</link>
		<comments>http://chrisdail.com/2010/02/09/version-control-and-bug-tracking-integratio/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 18:17:22 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[bug-tracking]]></category>
		<category><![CDATA[bugzilla]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://chrisdail.com/?p=81</guid>
		<description><![CDATA[Two of the most useful tools to a developer outside of their development environment are version control and bug tracking systems. Version control allows tracking of changes to the product and allows for branching and merging. Bug tracking systems allow for tracking issues with the product whether they be bugs or enhancements. Even though these [...]]]></description>
			<content:encoded><![CDATA[<p>Two of the most useful tools to a developer outside of their development environment are version control and bug tracking systems. Version control allows tracking of changes to the product and allows for branching and merging. Bug tracking systems allow for tracking issues with the product whether they be bugs or enhancements.</p>
<p>Even though these tools are often separate products, they have a major commonality which is the code you are working with. Often times you want to be able to see for any given bug number, what code was changed for that bug. Also, for a change in the code (in version control) you want to see if it was associated with a particular issue in the bug tracking software.</p>
<p>At the company I work for we use Subversion for version control and Bugzilla for bug tracking. We have some best practices around these tools to make things easier.</p>
<p><strong>Version Control and Bug Tracking Best Practices</strong></p>
<p>When resolving issues in the bug tracking database, our team always puts in the build number of the build that contains the fix. This way a person who is looking at the bug can know if the build they have contains the fix. Anytime our team fixes a bug we put in a comment that looks like this:</p>
<pre class="brush: plain; ">

Build Fixed: 1.0.1.12354
</pre>
<p>The last number is the revision number in Subversion.</p>
<p>When we commit code changes to Subversion, we also include the bug number for the bug being fixed. Our commit messages always appear in this format:</p>
<pre class="brush: plain; ">

Bug 1234: Fixed this bug
</pre>
<p><strong>Subversion Tooling</strong></p>
<p>Recently I came across a neat feature in Subversion that allows you to link it to a bug tracking system. Basically this allows clicking on the bug number in the subversion history view to take you directly to the bug number in the bug tracking software.</p>
<p>Enabling this feature is fairly simple to do and involves setting 2 properties in the subversion repository. These properties need to be set on the root folder in subversion that you would use to checkout your project from. It automatically is available for everything in that tree but you need to checkout from this root for it to work. These are the two properties that need to be set.</p>
<ul>
<li>bugtraq:logregex &#8211; This defines a regular expression to &#8216;match&#8217; bug numbers in subversion comments. For the pattern I listed above, we are using: [Bb][Uu][Gg] (\d+)</li>
<li>bugtraq:url &#8211; This defines a URL to go to when the user clicks on a bug number. The browser is launched when the number is clicked on and takes you to this URL replacing the BUGID parameter. For our bugzilla repository we are using: https://some.server.somewhere.localhost/show_bug.cgi?id=%BUGID%</li>
</ul>
<p>The following steps walk through this process of how to set this up using <a href="http://tortoisesvn.tigris.org/">Tortoise SVN</a>:</p>
<ul>
<li>On the root folder of your subversion working copy, right click on the folder and click TortoiseSVN -> Properties.
<p><a href="http://chrisdail.com/wp-content/uploads/2010/02/svn-properties.jpg"><img src="http://chrisdail.com/wp-content/uploads/2010/02/svn-properties-238x300.jpg" alt="" title="svn-properties" width="238" height="300" class="alignnone size-medium wp-image-106" /></a></li>
<li>Add each property listed above as new properties to the list.
<p><a href="http://chrisdail.com/wp-content/uploads/2010/02/svn-bugtraq.jpg"><img src="http://chrisdail.com/wp-content/uploads/2010/02/svn-bugtraq-300x228.jpg" alt="" title="svn-bugtraq" width="300" height="228" class="alignnone size-medium wp-image-109" /></a>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisdail.com/2010/02/09/version-control-and-bug-tracking-integratio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just like Taking out the Garbage (With Version Control)</title>
		<link>http://chrisdail.com/2007/12/04/just-like-taking-out-the-garbage-with-version-control/</link>
		<comments>http://chrisdail.com/2007/12/04/just-like-taking-out-the-garbage-with-version-control/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 19:41:00 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://chrisdail.com/2007/12/04/just-like-taking-out-the-garbage-with-version-control/</guid>
		<description><![CDATA[I had a Mathematics teacher in High School who used to get very excited over factoring problems where you could simplify expressions by canceling out terms. He used to say it was just like &#8220;taking out the garbage&#8221;. Taking out the garbage was not usually a fun task but it is surprisingly satisfying to get [...]]]></description>
			<content:encoded><![CDATA[<p>I had a Mathematics teacher in High School who used to get very excited over factoring problems where you could simplify expressions by canceling out terms. He used to say it was just like &#8220;taking out the garbage&#8221;. Taking out the garbage was not usually a fun task but it is surprisingly satisfying to get rid of stuff that is not necessary and is just clutter. I run into this same sort of thing when developing software. I just love to &#8220;take out the garbage&#8221;.</p>
<p>Version Control software is essential to any project, no matter how small (That in itself is a topic for another day). Version Control software gives you the ability to take out the garbage all of the time without having to worry about losing something that is important. You can always go back to old versions of a file if you need them at a later point in time.</p>
<p><span style="font-weight: bold">Delete Unused Classes</span></p>
<p>Often when you are refactoring a component or adding something you end up with a Class that was used before that is no longer relevant. Delete it. Remember that you can always get it back later if you need it again through your Version Control system. It does not matter how &#8216;useful&#8217; this code was, how &#8216;nice&#8217; it looks, how &#8216;cool&#8217; it is. It may have been a useful utility that you might need again. You have to resist these urges to keep it around. Unless you know for a fact that you will use it again, you should get rid of it. It is not gone forever and you can get it back if you need it. This will help reduce the complexity of your code and consequently the readability.</p>
<p><span style="font-weight: bold">Delete Unused Code, Don&#8217;t Comment It Out</span></p>
<p>I see a lot of developers who take a piece of code that is no longer used and comment out the entire section. Resist the urge to keep it inside the code. You can always get the code back through version control, so why do you want to keep a long comment block somewhere where it needs to be maintained? Another danger to this is that if you do want to use this code later on, you will likely end up removing comments around code that no longer compiles. Things change and this once working code may no longer work after you uncomment it.</p>
<p>The follow code is a good example of this. The line that was commented called a function that takes 2 parameters. Notice that the current version of the function takes only one. Code blocks that are commented out are not compiled so the code is not kept up to date with the rest of the code.</p>
<p><span style="font-family: courier new">// We don&#8217;t need to do this anymore</span><br />
<span style="font-family: courier new">// variable = someFunction(a, b)</span></p>
<p><span style="font-family: courier new">someFunction(a) {</span><br />
<span style="font-family: courier new">    &#8230;</span><br />
<span style="font-family: courier new">}</span></p>
<p>It is simply better to just delete the code block. If you need it at some point in time later, the version control software can resurrect your lost code.</p>
<p><span style="font-weight: bold">Bug #12324 Add a heading here</span><br />
<span style="font-weight: bold">Bug reference numbers are not necessary</span></p>
<p>I have seen lots of code with comments around a changed block indicating the change was for a particular bug. Before long, the code has a mess of comments all over the place indicating bugs that were fixed and where. This is another case where version control software can eliminate comments that unnecessarily clutter your code. This one does require a bit more discipline though.</p>
<p>Always indicate the bug number being fixed and a small when checking in code into Version Control. For example, you could add a comment like &#8220;Bug 12324: Added heading to section&#8221;. Then when you look through the Version Control log, you can easily see where changes were made and what they were made for.</p>
<p>If you are looking at a particular line of code and you need to know where it came from and why, you can use the &#8220;blame&#8221; feature. That will give you the person who last changed the line of code you are looking at along with the comment (which should include the bug number and fix description). For more information on this feature of version control systems, check out the &#8220;Who wrote this Crap?&#8221; (<a href="%28http://www.codinghorror.com/blog/archives/000992.html%29">http://www.codinghorror.com/blog/archives/000992.html</a>) article on Coding Horror.</p>
<p><span style="font-weight: bold">Taking Out the Garbage</span></p>
<p>So next time you are confronted with &#8220;stuff&#8221; that is not longer used. Delete it and let your version control do the work of remembering it. This will keep your code much cleaner and easier to read. It is just like taking out the garbage.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisdail.com/2007/12/04/just-like-taking-out-the-garbage-with-version-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
