3
votes

I'm trying to split an old SVN repository that contains multiple projects.
I tried to dump the whole repository, filter it, then load into a new repository, but because of previous copies and renames, svndumpfilter ends with an invalid copy source path error, unless I include more folders:

svnadmin dump OldRepository > OldRepository.dump
svndumpfilter include --drop-empty-revs --renumber-revs "/UnwantedFolder1" "/UnwantedFolder2" "/WantedFolder" < OldRepository.dump > WantedRepository.dump

As a workaround, I used exclude in svnadmin dump:

svnadmin dump OldRepository --exclude "/UnwantedFolder1" --exclude "/UnwantedFolder2" --exclude "/EvenMoreUnwantedFolders" > WantedRepository.dump

I can load this dump into a new repository, the only problem is that it is full of empty revisions. I tried using svndumpfilter to eliminate them, but from the output it looks like it keeps all these revisions (and renumbers them to their original number).

svndumpfilter --drop-empty-revs --renumber-revs include "/" < WantedRepository.dump > FilteredWantedRepository.dump

Another strange thing is that even if I filter without the switches, loading the resulting dump into a new repository ends with an error:

svndumpfilter include "/" < WantedRepository.dump > NotReallyFilteredWantedRepository.dump
svnadmin create NotReallyFilteredWantedRepository
svnadmin load NotReallyFilteredWantedRepository < NotReallyFilteredWantedRepository.dump

svnadmin: E140001: Dumpstream data appears to be malformed

The only difference I found between the two dump files is that in WantedRepository.dump there is

Revision-number: 1
Prop-content-length: 10
Content-length: 10

PROPS-END

Revision-number: 2
Prop-content-length: 10
Content-length: 10

PROPS-END

While in NotReallyFilteredWantedRepository.dump the PROPS-END rows are missing.

Revision-number: 1
Prop-content-length: 10
Content-length: 10


Revision-number: 2
Prop-content-length: 10
Content-length: 10

What is the problem with the svndumpfilter's output?
How can I remove the empty revisions?

1

1 Answers

1
votes

I made a few tests and it looks like there's no easy way to do this, since svnadmin dump does not have the same options as svndumpfilter. The options (--drop-empty-revs etc.) were mentioned in the comments in the original issue about --include and --exclude, but they were not implemented: https://issues.apache.org/jira/browse/SVN-4729
I'm not even sure whether the --exclude option is considered final or still under development.

As long as you don't have copies and renames, svndumpfilter works fine.
If there are copies, then you either have to include them in svndumpfilter, or use svnadmin dump --exclude, but there are caveats:

  1. Revisions that contained modifications of excluded items only will be replaced by an empty revision with no properties at all (unlike empty revisions generated by svndumpfilter). You can remove these by hand, but using svndumpfilter on them will only remove their PROPS-END rows, generating a malformed dump file.

  2. Revisions that contained modifications of excluded items will lose their svn:log property even if they contain modifications of included items as well.

Example
After creating folder B, and renaming it to A, the full dump includes:

Revision-number: 1
Prop-content-length: 108
Content-length: 108

K 10
svn:author
V 6
654321
K 8
svn:date
V 27
2019-11-25T09:55:46.768984Z
K 7
svn:log
V 8
Folder B
PROPS-END

Node-path: B
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END


Revision-number: 2
Prop-content-length: 115
Content-length: 115

K 10
svn:author
V 6
654321
K 8
svn:date
V 27
2019-11-25T09:58:38.976139Z
K 7
svn:log
V 14
renamed B to A
PROPS-END

Node-path: A
Node-kind: dir
Node-action: add
Node-copyfrom-rev: 1
Node-copyfrom-path: B


Node-path: B
Node-action: delete

After excluding B from the dump (svnadmin dump --exclude "/B" Repository > AOnly.dump), revision 1 is replaced by an empty revision, and revision 2 loses its svn:log property:

Revision-number: 1
Prop-content-length: 10
Content-length: 10

PROPS-END

Revision-number: 2
Prop-content-length: 83
Content-length: 83

K 10
svn:author
V 6
654321
K 8
svn:date
V 27
2019-11-25T09:58:38.976139Z
PROPS-END

Node-path: A
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END