tags:

views:

1771

answers:

3

I am working a project that does not have a trunk / branches / tags directory structure - ie. everything is in the root of the svn repo.

I would like to create a trunk directory and in the root directory, and move everything in the root directory into the new trunk directory.

What is the best way to do this?

The first thing I considered was

svn mkdir trunk
(for each file or directory that is not called trunk: )
svn mv FILEorDIR trunk/

But this effectively deletes every file and then adds it again. Is there a better way?

Thanks.

A: 

You may want to look into the svnadmin tool.

To be honest I have not tried this before, and you'll probably get an answer from someone who has, but you can work from something like this:

You should be able to init a new repository, create a 'trunk' directory in it, then dump your previous repository into the 'trunk'.

saffsd
+2  A: 

This is similar to the way I've done it in the past. Your solution actually copies each file, then deletes the original. Because of the way Subversion implements copies, the history for every file is preserved.

After doing this, you can point existing checkouts at the new location using svn switch.

Greg Hewgill
can you give the exact command for svn switch? Also, is there a way to force switch to not update to the latest revision in the working copy where it is run?
Vijay Dev
@Vijay Dev: I recommend the [`svn switch` documentation](http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.switch.html) for full details.
Greg Hewgill
A: 

If you are using eclipse IDE and Subclipse for SVN then you can go ahead and create folders in SVN and move all the files/dir from root to the trunk directory and then checkout the ProjectName/trunk to you eclipse workspace...

AmBaltimore