This repository has been archived on 2017-04-03. You can view files and clone it, but cannot push or open issues/pull-requests.
blog_post_tests/20111102200717.blog

17 lines
3.1 KiB
Plaintext

Revenge of the reposturgeon!
<p>Reposurgeon 1.5 is out. This is a major release based on experience gained converting the <a href="http://roundup.sourceforge.net">roundup</a> repository.</p>
<p><span id="more-3897"></span></p>
<p>The main new feature is code to help in fixing up fossil CVS and SVN commit references, turning them into <a href="http://esr.ibiblio.org/?p=3872">action stamps</a>. I had to think about the design carefully here, because the task combines a front end that humans do better than machines with a back end that machines do much better than humans.</p>
<p>The problem: You&#8217;ve lifted your Subversion repo to git with git-svn or some similar tool. But the comments still have references in them that look like, say, &#8220;r2317&#8243;. You want to replace these to point to the corresponding changesets in the git repo, but there may be lots of them, and even if patching each one by hand weren&#8217;t a huge pain in the ass it&#8217;s a fiddly job at which your error rate is likely to be significant.</p>
<p>The part of this task humans are good at is recognizing from context all the random forms a reference can take. There&#8217;s the canonical &#8220;r2317&#8243;, &#8220;SVN#2317&#8243;, &#8220;commit 2317&#8243;, &#8220;rev 2317&#8243;, and other variants. Machines aren&#8217;t good at reduciing ambiguity; I passed on solving the strong-AI problem and designed for a workflow in which the human first replaces all these variants with a uniform machine-parseable cookie &#8211; to wit, &#8220;[[SVN:2317]].</p>
<p>Then the machine does what it&#8217;s good at, which is crunching through the logic to replace that cookie with an action-stamp pointing at the same changeset. A human doing this by hand would be prone to boredom-induced detail errors and typos.</p>
<p>How does it get the mapping from revision number to time!committer? One way is if the repo comments contain metadata put in changeset comments specifically to support this, which git-svn does. (reposurgeon also has a command to strip out all that metadata when you&#8217;re done with it.)</p>
<p>Or &#8211; and here&#8217;s the tricky part &#8211; reposurgeon will sometimes be able to mine that information out of CVS keyword expansions. So, to take a real-world example from the roundup repo, let&#8217;s say a blob in the repo has this string in it:</p>
<blockquote><p><code><br />
$Id: ru.po,v 1.6 2004-07-03 13:51:03 a1s Exp $<br />
</code></p></blockquote>
<p>Then reposurgeon knows that the reference cookie [[CVS:ru.po:1.6]] should be replaced by an action-stamp pointing at whatever commit this blob is attached to (if there are two or more such commits it just grabs the first; this is a bug and I&#8217;ll fix it in 1.6).</p>
<p>UPDATE: Duh&#8230;I had already fixed it to throw an error in that case! What I need to do is try to correctly handle cases where all but one of the possibilities can be discarded because they refer to the wrong branches.</p>
<p><a href="http://www.catb.org/esr/reposurgeon/">Fear the reposturgeon!</a></p>
<p>UPDATE: Mike Swanson pointed out a Python 3 compatibility problem, so I snap-released 1.6 about a day later.</p>