Using piped svndumpfilter commands to separate an svn repository

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.

Example:
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.

Example:
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.

6 Responses to “Using piped svndumpfilter commands to separate an svn repository”


  1. mike

    This also works:

    svndumpfilter exclude `cat filterlist.txt` new.dump

  2. mike

    blah, it ate my comment

    it should read:

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

  3. Dennis

    Thanks for the additional tip!

  4. Cranky Bit » Blog Archive » Separating a Large Repository

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

  5. Marcus

    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

  6. Marcus

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



css.php