<?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>The Dumping Ground &#187; Perl</title>
	<atom:link href="http://ardvaark.net/category/technology/perl/feed" rel="self" type="application/rss+xml" />
	<link>http://ardvaark.net</link>
	<description>And who cares?</description>
	<lastBuildDate>Thu, 19 Jan 2012 16:29:08 +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>Subversion Dump File Splitter</title>
		<link>http://ardvaark.net/subversion-dump-file-splitter</link>
		<comments>http://ardvaark.net/subversion-dump-file-splitter#comments</comments>
		<pubDate>Mon, 14 Nov 2005 01:22:42 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I recently had to do some mangling of a dump of my personal Subversion repository. Basically, I had to modify some paths and revision copy numbers before re-importing to a clean repository. However, the dump was in one huge 300 MiB file, making it really difficult for to open for editing. Normally, the solution would [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to do some mangling of a dump of my personal <a href="http://subversion.tigris.org">Subversion</a> repository.  Basically, I had to modify some paths and revision copy numbers before re-importing to a clean repository.  However, the dump was in one huge 300 MiB file, making it really difficult for to open for editing.</p>
<p>Normally, the solution would simply be to re-dump the repository using the <tt>--revision</tt> option to the <a href="http://svnbook.red-bean.com/en/1.1/ch05s03.html#svn-ch-5-sect-3.1.2"><tt>svnadmin dump</tt></a> command.  Unfortunately, in a flash of stupidity, I deted my old repository before I had the new one working.  So I wrote a little <a href="http://en.wikipedia.org/wiki/Perl">Perl</a> script to split the dumpfile into seperate files.</p>
<p><code><br />
#!/usr/bin/perl</p>
<p>open(REV, "> repo") || die("Unable to open $!");</p>
<p>while (<>)<br />
{<br />
    $line = $_;</p>
<p>    if (/^Revision-number\:\s+(\d+)$/) {<br />
        open(REV, "> rev.$1") || die("Unable to open $!");</p>
<p>        if (!$header) {<br />
            open(REPO, "< repo") || die("Unable to open $!");</p>
<p>            while (<REPO>) {<br />
                $header = $header . $_;<br />
            }<br />
        }</p>
<p>        print REV $header;<br />
    }</p>
<p>    print REV $line;<br />
}<br />
</code></p>
<p>Ah&#8230;short and sweet, just the way a Perl script should be.  Normally, I would immediately delete any Perl that I might happen to write, as I think the language is too flexible to be properly maintained over any length of time.  However, since I can&#8217;t find anything else like this out on Teh Intarweb, I figure I&#8217;ll leave it here for posterity.</p>
]]></content:encoded>
			<wfw:commentRss>http://ardvaark.net/subversion-dump-file-splitter/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

