<?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>Josh Butts .com &#187; Software Development</title>
	<atom:link href="http://www.joshbutts.com/topics/software-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joshbutts.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 15 Aug 2009 19:55:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Keeping track of merges in SVN 1.5</title>
		<link>http://www.joshbutts.com/posts/keeping-track-of-merges-in-svn-15/</link>
		<comments>http://www.joshbutts.com/posts/keeping-track-of-merges-in-svn-15/#comments</comments>
		<pubDate>Mon, 18 May 2009 04:47:30 +0000</pubDate>
		<dc:creator>josh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.joshbutts.com/?p=3</guid>
		<description><![CDATA[I’ve finally migrated to Subversion 1.5 hoping to be completely wowed by the new merge tracking features.  While they may be great on paper, the Subversive/SVNKit connectors that come with Eclipse (rather, Zend Studio for Eclipse) are less than exciting.  If you’re expecting, “wow, new interface and features”, don’t be, it’s a mild change at best.  However, the merge tracking definitely works and it works automagically.]]></description>
			<content:encoded><![CDATA[<p>I’ve finally migrated to Subversion 1.5 hoping to be completely wowed by the new merge tracking features.  While they may be great on paper, the Subversive/SVNKit connectors that come with Eclipse (rather, Zend Studio for Eclipse) are less than exciting.  If you’re expecting, “wow, new interface and features”, don’t be, it’s a mild change at best.  However, the merge tracking definitely works and it works automagically.  The issue that I’ve run into with it is that while it may track what has been merged where just fine, someone still has to track all the things have haven’t been merged.  This especially true if you have a “stable” branch in your code.  As you bring features and updates from the trunk into that branch, SVN will happily track the revision numbers that you’ve merged.  But, what about all those ones that haven’t been merged yet?</p>
<p>Up until today, I’ve been going through a tedious process of reading the svn:mergeinfo field and comparing that against the commit logs from WebSVN or Fisheye, and then using the “whiteboard” method to keep tracking of that still needs to be looked at.  To solve this problem, I wrote a quickie PHP script that will read the svn:mergeinfo property as well as another property I’ve created called “minmerge” and spit out a list of revisions to look over.  The minmerge property is basically a number I set by hand that denotes how far back in to look.  Anything lower than that revision number is assumed to have already been processed and either merged or decided not to be merged.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #000088;">$mergedcmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;svnlook pg /svn/testrepo svn:mergeinfo /branches/stable&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$minmergecmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;svnlook pg /svn/testrepo minmerge /branches/stable&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$mergemsgcmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$merged</span> <span style="color: #339933;">=</span> <span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mergedcmd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$minmerge</span> <span style="color: #339933;">=</span> <span style="color: #990000;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$minmergecmd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$merged</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/trunk:&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$merged</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$revs</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$merged</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;found &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$revs</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; merges <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$revs</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$rev</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rev</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$bounds</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rev</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$bounds</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #000088;">$bounds</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$rev</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$min</span> <span style="color: #339933;">=</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;found &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; revisions from <span style="color: #006699; font-weight: bold;">$min</span> to <span style="color: #006699; font-weight: bold;">$max</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;ignoring revs above <span style="color: #006699; font-weight: bold;">$minmerge</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$min</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #000088;">$max</span><span style="color: #339933;">;</span> <span style="color: #000088;">$c</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">,</span> <span style="color: #000088;">$realrevs</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$minmerge</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$unmerged</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$unmerged</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;found &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$unmerged</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; unmerged revisions:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$unmerged</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$rev</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$rev</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.joshbutts.com/posts/keeping-track-of-merges-in-svn-15/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
