Common problems: a repository in on server A and needs to be migrated onto server B; a single repository needs to be spit into few separate ones; what to do with local working copies after server migration; the repository storage method needs to be changes e.g. from berkleyDB to file-system.
In some simple cases the repository can be moved directly on file system level. However, the following steps describes a more complex case, in a generally applicable way: a migration and split of repositories from one server to another, fixing the local working copies. Assume this situation:
ServerA, repository: projects path: /proj1 path: /proj2
ServerB: repository: proj1 path: / ServerB: repository: proj2 path: /
For example: https://svn.server.com/projects/proj1 -> https://mysvn.com/proj1
1. Export the repository on ServerA
svnadmin dump /path/to/repos/projects > projects.dump
2. Split / filter out repositories
svndumpfilter include proj1 < projects.dump > proj1.dump
svndumpfilter include proj2 < projects.dump > proj2.dump
3. Fix the paths
As the dump is in a text format you can easily edit it to change prune the projects root directory. You do it:
- by renaming the paths:
sed -e "s/Node-path: projects//Node-path: /" < proj1.dump > proj1-fixed.dump
The same for proj2.dump
- and removing the section that creates the root directory, i.e. delete the following lines form somewhere at the beginning of both dumps proj1-fix.dump and proj2-fix.dump:
4. Import the repositories on Server
Create a new repository for each project and import the dumps. (A detailed description of how to setup a Subversion (and friends) is in my previous post)
svnadmin create /path/to/repos/proj1
svnadmin load /path/to/repos/proj1 < proj1-fixed.dump
Do it analogically also for proj2.
Happy checkout :) After migration you'd rather check/modify/recreate the hooks, users for authentication (if you used some of those). And again, read the official SVNBook for details.
Fixing existing working copies
If you don't want to checkout but rather continue using existing working copies you can (cannot be done in case of some repository splits).
First of all, use
--force-uuid option for
svnadmin load (step 4). Then you can tweak the local copy by running (in the root of the local repo):
svn switch --relocate http://ServerA/testproject https://ServerB/project .