how to use svndumpfilter to exclude a certain revision

Nate Glenn picture Nate Glenn · Jul 27, 2012 · Viewed 9.9k times · Source

I have an SVN repository with a bad revision or two. I need to get rid of them! I was planning on using the svndumpfilter tool, which has an exclude command. However, I cannot figure out how to use it to exclude a revision. Everytime I use it, I end up with a Malformed dumpfile header error. See the command below; I want to exclude revision 23, and code is the directory containing the repository.

>svndumpfilter exclude 23 code
Excluding prefixes:
   '/23'
   '/code'

SVN-fs-dump-format-version: 2

<waits for me to type something and press enter>

'vndumpfilter: E140001: Malformed dumpfile header '

Answer

Peter Parker picture Peter Parker · Jul 28, 2012

svndumpfilter tool uses the stdin as input and filters only on certain paths, so you cannot exclude a specific revision. However you can try to dump your repository from rev 0 to rev. 22 and continue from rev 24 to HEAD, however, this will work only if no file changed in rev 23 is changed after rev 23 again.

Here a small script:

svnadmin dump my -r0:22 code > /path/to/dumpfile_1.dmp
svnadmin dump --incremental -r24:HEAD code > /path/to/dumpfile_2.dmp

If you want to create a new repository out of dumpfiles:

svnadmin create code_correct
svnadmin load code_correct <  /path/to/dumpfile_1.dmp 
svnadmin load code_correct <  /path/to/dumpfile_2.dmp