Recently we were restructuring our project repositories, where I had to move a project from it’s own repository to another repository.
When do a move under SVN you need to make sure that the history is not lost, so I will explain two common scenarios and how you could do the SVN move
###Scenario 1 - Moving files or directories with in a SVN repository
Below is a screen shot of my existing repository and I want to move the configuration directory to the project directory without loosing the history.
First of of all this will work only for the versioned items, so please commit your changes to the directory you want to move before doing this. The steps explained below assumes that you are using Tortoise SVN
Here are the steps
- Right click on the directory you want to move
- Drag and drop on to the directory where you want to move this.
- Choose the SVN Mover Versioned item(s) here item from the context menu.
- Now commit the changes back to the repository.
Don’t forget to uncheck Stop on copy/rename option in the Log messages dialog if you are trying to see the history of the moved directory.
###Scenario 2 – Moving directories across SVN repositories
In this case I want to move Project directory to another repository Repo2
The first technique I have mentioned will work only if the source and target are under same repository, but in some cases you have to move the directories across different SVN repositories. This cannot be done from a SVN client slike TortoiseSVN, you need o use the utilities that comes with SVN.
Follow these steps
- Dump the repository to a file using the
svnadmintool – e.g.
svnadmin dump c:\Repositories\Repo1 > Repo1file
- Now load the dumped filed into the target repository – e.g.
svnadmin load c:\Repositories\Repo2 < Repo1file
Here is the full syntax for svnadmin tool
$ svnadmin dump --help