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?
views:
271answers:
6Can’t you just create the trunk dir and move everything from / to trunk?
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.
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.
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
.
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.
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.