Extracting a Directory into its Own Subversion Repository[source]

    <title>Extracting a Directory into its Own Subversion Repository</title>
    <description>Legacy blog post about extracting a directory in a subversion server to its own, new repository</description>
    <category>Source control</category>
    <category>Legacy blog posts</category>
<glacius:macro name="legacy blargh banner">
  Like my <glacius:link page="articles/running-a-subversion-server-on-windows">previous subversion 
  post</glacius:link>, this is something that is a bit difficult to find on the internet.
  Every so often, you realize that a project is growing too big, and it deserves its own repository. What 
  you want is to extract a single directory from one repository, and create an entirely new repository that
  only has the revisions related to that one directory in it. And it would be nice if they started from one. 
  Luckily, subversion provides just such a tool for doing it.
<p>Suppose your repo looks like this:</p>
<glacius:code lang="plaintext"><![CDATA[/foo
  and you want to remove the "bar" directory and create a new repository out of it. Here is what you would do:
<glacius:code lang="bash"><![CDATA[
svnadmin dump /path/to/big/repo > repodump
cat repodump | svndumpfilter include bar --drop-empty-revs --renumber-revs > newrepodump
svnadmin create newrepo
svnadmin load newrepo > newrepodump]]></glacius:code>
  You'll probably want to create trunk, tags and branches for your new repo, so you have two choices:
  <li>Try and figure out how to modify the dump file and delete the proper nodes (impossible)</li>
  <li>Say screw it, and just <code>svn mv</code> the files around after you've loaded the revision into the new repo</li>
  This is all fine until you realize that <code>svndumpfilter</code>doesn't play nice with an 
  <code>svn mv</code> outside of the directory you're filtering. That's when you have to play 
  with the <code>exclude</code> subcommand, and pipe the output about 30 different times to 
  <code>svndumpfilter</code> until you've got what you want. It's not enjoyable. I'll leave this one 
  as an exercise to the reader.