To move a folder or document between SVN repositories by retaining history, following steps would help.
Step I
Dump the entire svn repository to a dump file with svnadmin dump. If the repository is too big to dump, better pipe the next two commands. Command here is split in the interest of easy understanding.
$ svnadmin dump D:\svn\old_repos > .\repository.dump
Step II
Once the repository is dumped, the specific file or folder has to be filtered with svndumpfilter include and a new dump has to be created. include
is used directly specify the path filter, in case if there are many filter paths, create a file with all paths each in a single line and use -target FILENAME
.
$ svndumpfilter include path/to/docs --drop-empty-revs --renumber-revs --preserve-revprops < .\repository.dump > .\docs_only.dump
Step III
Now the docs_only.dump has only documents. The next step is to load it to new repository with svnadmin load.
$ svnadmin load D:\svn\new_repos < ./docs_only.dump
While loading, the below mentioned error may occur.
<<< Started new transaction, based on original revision 1
* adding path : path/to/docs ...svnadmin: E160013: File not found: transaction '91-2k', path 'path/to/docs'
It is because, the path is not available in the new repository. In this example path/to
doesn't exist. So this path has to be created before loading.