views:

271

answers:

6

I made the mistake of creating a Subversion repository without the usual trunk, branches, and tags directories. That is, the root directory of the project maps to the root directory of the repository. Now I want to create a feature branch, but there's no good place to put it. What I'd like to do is move / to /trunk, preserving its properties and history. Am I out of luck?

+1  A: 

Can’t you just create the trunk dir and move everything from / to trunk?

zoul
+1  A: 

As the other answers point out, just doing a svn mv into the trunk directory will do this. To then update your working copy, check out the svn switch command.

dreeves
+2  A: 

No just create a trunk folder and move all the contents of the root to it. You can do it from explorer or through the repo-browser, the history will persist.

James
+2  A: 

You need to create /trunk and do an svn move of all contents of root inside the trunk and then commit.

After that you'll switch your working copy to /trunk.

cherouvim
+3  A: 

The easiest way would be to create a 'trunk' directory, then move everything else into it. You'll have to copy any properties manually, but it shouldn't be a big deal. The history is per-file, so it should remain.

The other issue to consider is whether anybody else has the repository open. It'll be difficult to merge, so make sure everyone has their changes checked in before you do this.

Benjamin Geiger
+1 for considering problems in case of a merge
sleske
It is the easiest way, but you need to beware that if you ever update back to a revision before the move then unexpected things will happen (your working copy will delete itself ;) )
therefromhere
Agreed. It's a bit trickier to use `svnadmin` but the results are better, and the merge issues are no worse than in the naïve method. I voted your answer up.
Benjamin Geiger
+7  A: 

The clean way to do this is using svnadmin to dump out the whole repository using

svnadmin dump

Then create a new repository with the trunk directory at the root, and reload the dump with

svnadmin load --parent-dir trunk

If you do an svn move then that will mess things up if you ever update back to a revision before the move, since the files will move back to their previous location, which is probably not what you want.

therefromhere
-1 No need to go to such lengths: Just move the whole tree.
sleske
@sleske - I've handled exactly this problem before - see my note about the problems of doing an svn move. This is the correct way to do it.
therefromhere
I've not had a chance to try this, but it sounds like exactly the solution I'm looking for.
Metaphile
@therefromhere: OK, convinced :-).
sleske