Upgrading a SVN repository

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>\svnglobal.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:

  1. create a new repository
  2. open a text editor and copy the batch file above.
  3. set svnadm with the full path name of your svnadmin.exe.
  4. set repo_out with the starting repository full pathname.
  5. set repo_in with the new repository full pathname.
  6. set file_dump for a temporary dump file. Depending on your repository size, it may need quite free disk space.
  7. save the file with something like: upgrade.cmd
  8. 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 may be need some adjustment.