Question

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!

Was it helpful?

Solution

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

OTHER TIPS

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.

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'

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top