<?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>Kris Range &#187; auto_props</title>
	<atom:link href="http://blog.krisrange.com/tag/auto_props/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.krisrange.com</link>
	<description>Web development</description>
	<lastBuildDate>Fri, 16 Sep 2011 15:23:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Inserting keywords/variables in Subversion with auto-props</title>
		<link>http://blog.krisrange.com/2010/07/inserting-keywordsvariables-in-subversion-with-auto_props/</link>
		<comments>http://blog.krisrange.com/2010/07/inserting-keywordsvariables-in-subversion-with-auto_props/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 07:18:17 +0000</pubDate>
		<dc:creator>krange</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[auto_props]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://blog.krisrange.com/?p=56</guid>
		<description><![CDATA[Spent a little time this week investing how to get keyword variables related to our Subversion repositories (version, last modified by, date, etc) automatically inserted into our code when we commit. My end goal was to have our code looking like the sample below with an initial comment header including our SVN information: /** * [...]]]></description>
			<content:encoded><![CDATA[<p>Spent a little time this week investing how to get keyword variables related to our Subversion repositories (version, last modified by, date, etc) automatically inserted into our code when we commit. My end goal was to have our code looking like the sample below with an initial comment header including our SVN information:</p>
<pre>

/**
 * ------------------------------------------------------------
 * Copyright (c) 2010 Some Company.
 * This software is the proprietary information of Some Company
 * All Right Reserved.
 * ------------------------------------------------------------
 *
 * SVN revision information:
 * @version $Revision: 82 $:
 * @author	$Author: kris $:
 * @date	$Date: 2010-07-10 08:36:02 +0200 (Sat, 10 Jul 2010) $:
 */
package com.somecompany.common.somepackage
{
	import flash.display.MovieClip;

	/**
	 * SomeClass description
	 *
	 * @author krisrange
	 */
	public function SomeClass
		extends MovieClip
	{
		/**
		 * Constructor
		 */
		public function SomeClass()
		{
			super();
		}
	}
}
</pre>
<p>As you can see, the SVN revision version, last modified author and last modified date show up in our headers. This is really important as a developer can look at the header and quickly know who last modified the file and who to talk to in case the initial author of the file may not be the developer who last updated functionality.</p>
<p>I will be writing this from the perspective of working on MacOS but most of this information is transferrable directly to a Windows machine except a few things like directory structures.</p>
<p>We need to make sure that files are setup to have their properties changed. The best thing to do is to change this globally for new files/repositories and then go back into any previous projects you have worked on and recursively loop through and add this functionality. </p>
<h3>Modifying the Global Setting:</h3>
<p>On MacOS, go into your home directory and open the &#8220;Config&#8221; file that lives in the hidden folder &#8220;.subversion&#8221;. Once you have this text file opened, uncomment the &#8220;enable_auto_props&#8221; variable in the &#8220;[miscellany]&#8221; section and set it&#8217;s value to &#8220;yes&#8221;. Then add the file types you would like include in the &#8220;[auto-props]&#8221; section with the value of &#8220;svn:keywords=Date Revision Author Id&#8221;. See sample below where I&#8217;ve set auto_props to modify all *.as and *.mxml files:</p>
<pre>
[miscellany]
### Automatic properties are defined in the section 'auto-props'.
enable-auto-props = yes

### Section for configuring automatic properties.
[auto-props]
*.as = svn:keywords=Date Revision Author Id
*.mxml = svn:keywords=Date Revision Author Id
</pre>
<h3>Modifying Previous Projects</h3>
<p>In order for previous projects to gain access to this information, we need to set the properties on all the files we have already committed to set the properties on themselves when they are committed into our repositories. To do this, just type the following command for every file type that you want to have auto_props enabled for.</p>
<pre>
find * -type f -name '*.as' -exec svn propset svn:keywords &quot;Date Revision Author Id&quot; {}  \;
</pre>
<h3>Getting the Values to Show Up</h3>
<p>After that is all setup, just insert the values in your document based on the corresponding ID. So for example, if you wanted to insert the Last Modified Author, insert it like below and SVN will replace the content inbetween the word &#8220;Author&#8221; and &#8220;$:&#8221; with the actual value:</p>
<pre>
$Author: $:
</pre>
<p>For more information on what keywords/properties are available, there is good <a href="http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html">documentation from Subversion</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.krisrange.com/2010/07/inserting-keywordsvariables-in-subversion-with-auto_props/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

