views:

500

answers:

4

I have an old but very important Subversion repository for which I haven't created form the start the usual structure: trunk, branches, tags. So all my files for this repository are residing in the root.

I know how to create the new folders and move all my files in trunk but if I do that I will lose my project's history for 3 years, since 'trunk' is a new folder. So is there a solution to move my entire project's history from root to the trunk folder?

Thanks!

A: 

Not an ideal solution admittedly, but why not create a whole new repository whose content is all of the code from the old repository but formatted nicely into trunk etc. keeping the old repository completely separate but making it read only.

This would admittedly be a pain to have to remember that before date X you need to look in the old repository rather than the new if you need to know the history of an item.

Richard
+3  A: 

Yes. You can use svnadmin dump which will dump the repository along with history to a file. You can then use svnadmin load to load the dump file into the trunk folder. Once that's done, delete the files from root.

svnadmin dump REPOS_PATH [-r LOWER[:UPPER]] [--incremental]
svnadmin load REPOS_PATH

Dump Doc: http://svnbook.red-bean.com/en/1.1/re31.html Load Doc: http://svnbook.red-bean.com/en/1.0/re36.html

Joshua Belden
If you add "-parent-dir trunk" to svnadmin load it will move all files in the trunk subsdirectory of the repository
Bert Huijben
+2  A: 

You can use

svn copy http://my.server/svn/repos/ http://my.server/svn/repos/trunk/ \
     -m "Copied"

To create a copy from your repository root (^/) to trunk/ (^/trunk), keeping all your history, including that of the root directory.

After that you can remove the files and subdirectories in the old location in the next commit.

Bert Huijben
Why not just svn mv my.server/svn/repos/ my.server/svn/repos/trunk/ -m "Moved"
Stefan
@Stefan: You can't move the parent directory (=the repository root) to a subdirectory of itself as that would give you an error.
Bert Huijben
+1  A: 

You won't loose history if you use svn mv the files. The history will be maintained. So you could use the svnadmin load -parent-dir trunk to redo your repository, but you'll need to do fresh checkouts of everything, since you should have a new UUID in the new repository.

svn co http://example.com/repos/
cd repos
svn mkdir trunk tags branches
svn mv a trunk/a
svn mv b trunk/b
svn ci -m 'Moving project into trunk'
Blair Zajac