Sometimes you may need to upgrade or regenerate a SVN repository, because it may be outdated and/or damaged.
After some investigations, I discovered that it is possible by a simple batch file like the following one:
:@echo off set svnadm="<path>\svnadmin.exe" set repo_out= "<full pathname of the old repository>" set repo_in="<full pathname of the new one>" set file_dump="<path>\repo.dump" %svnadm% dump %repo_out% > %file_dump% %svnadm% load %repo_in% < %file_dump% del %file_dump%
Essentially it exports all revisions data to a file, and it imports them into a newly created repository.
Before running this one you need to:
- create a new repository
- open a text editor and copy the batch file above.
- set svnadm with the full pathname of your svnadmin.exe.
- set repo_out with the starting repository full pathname.
- set repo_in with the new repository full pathname.
- set file_dump for a temporary dump file. Depending on your repository size, it may need quite free disk space.
- save the file with something like: upgrade.cmd
- open a command prompt and start it.
When it ends, you will have an upgraded and fixed (and usually smaller) copy of your old repository.
PS: the batch file above is working fine on Windows machines. For all other OSs, I suppose it maybe need some adjustment.