All My Brain Where stuff from my brain lands

October 15, 2007

Using piped svndumpfilter commands to separate an svn repository

Filed under: System Administration — Tags: , , , , , — Dennis @ 7:46 am

According to the documentation for svndumpfilter, you can include one subcommand when filtering a dumped repository. Suppose you have a repository that has a path “/some/path” that you’d like to separate out into its own new repository. From the documentation, you simply pipe the original dumped repository through the svndumpfilter command.

cat repos-dumpfile | svndumpfilter include some/path > new-dumpfile

The caveat is that if there are paths copied from other paths in your repository that the include argument does not cover, you’ll get an error. I got around this command by piping the output from one svndumpfilter command to another, each with exclude commands instead of include commands. The result leaves only the paths I want, but included the alternate copy branch that I had used part way through the coding process.

cat repos-dumfile | svndumpfilter exclude unwanted/one | svndumpfilter exclude unwanted/two | svndumpfilter exclude unwanted/three --drop-empty-revs --renumber-revs > new-dumpfile

Notice on the last svndumpfilter command, I added a couple arguments to renumber the repository revisions and drop the empty revisions. While these are of course optional, in my opinion, they make the new repository cleaner.

The subversion book states you can edit the Node-Path values in the dumped file to have the new repository imported at different paths. I chose to simply issue an “svn mv” command once I imported the repository.


  1. This also works:

    svndumpfilter exclude `cat filterlist.txt` new.dump

    Comment by mike — October 30, 2008 @ 12:53 pm

  2. blah, it ate my comment

    it should read:

    svndumpfilter exclude `cat filterlist.txt` < old.dump > new.dump

    Comment by mike — October 30, 2008 @ 12:55 pm

  3. Thanks for the additional tip!

    Comment by Dennis — October 30, 2008 @ 1:03 pm

  4. […] to pull just a single directory, you must filter a complete dump with the “svndumpfilter” command. This blog post by basically explains how to accomplish this in Linux. I usually have to work on a […]

    Pingback by Cranky Bit » Blog Archive » Separating a Large Repository — November 4, 2008 @ 6:54 am

  5. Can somebody give me a short example how the entries in filterlist.txt need to look like for this to work?

    svndumpfilter exclude `cat filterlist.txt` new.dump

    Comment by Marcus — October 29, 2010 @ 11:12 am

  6. Ok, got it 🙂
    No need to put an extra call for every ‘include/exclude’ filter. This is enough
    svndumpfilter exclude unwanted/one unwanted/two …

    Comment by Marcus — October 29, 2010 @ 9:45 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress

%d bloggers like this: