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.

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.

This entry was posted in System Administration and tagged , , , , , . Bookmark the permalink.

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

  1. mike says:

    This also works:

    svndumpfilter exclude `cat filterlist.txt` new.dump

  2. mike says:

    blah, it ate my comment

    it should read:

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

  3. Dennis says:

    Thanks for the additional tip!

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

  5. Marcus says:

    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 says:

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

Comments are closed.